Hello all,
I am new to DokuWiki and I am pretty unfamiliar with Apache etc. All my previous "webadmin" experience were with Joomla, which sets things up by itself. Now I just got stuck in a (probably) Apache issue and all the forum posts, documentation and googling can't help me to find out what's happening.
I created a new domain, let's call it
www.example.com in a hosting company I where I have other websites. In my
/public_html folder, I created a folder called (let's say)
example.com. Under this directory I installed DokuWiki under a folder called
/dw.
So I have DokuWiki under my /public_html/example.com/dw directory and DNS configured to point
www.example.com to /public_html/example.com . Good.
After dealing with a lot of directory/file permissions stuff I managed to have DokuWiki apparently working fine when I accessed it with the URL
example.com/dw. Next step: get nicer URLs.
After copying the
htaccess.dist file to my
example.com directory and uncommenting the rewrite lines, I was able to have my DokuWiki homepage being shown in the browser when I typed URL
example.com there.
BUT there is something weird happening:
1 - Type URL
example.com in the browser, then DokuWiki shows the homepage perfectly. Nothing changes in the URL field in the browser.
2 - Then I click in the login link. Browser shows the login page. URL field is set to
http://brasiliaminha.com.br/dw/Homepage?do=login§ok=....
3 - I type my username, password, then I click the button to log in. Sidebar shows I have logged in. But browser shows a "This topic does not exist" page and the URL field now has a
example.com/dw/dw/homepage URL.
4 - Then I click the "Admin" link to get to the config pages. The Administration page opens perfectly in the browser. And now I got
one more /dw in the URL:
http://brasiliaminha.com.br/dw/dw/dw/homepage?do=admin
5 - Ok, let's try the DokuWiki configurations link in the page. It is correctly loaded. But now there is
one more /dw in the URL:
http://example.com/dw/dw/dw/dw/homepage?do=admin&page=config
6 - Well... Let's change something and get out of here. Click "save" then I'm took back to the Administration page -- and, guess what, there is another extra
/dw in the browser URL:
http://example.com/dw/dw/dw/dw/dw/homepage?do=admin .
7 - Enough administration, enough
/dw's, let's click in the banner image to get to the homepage! Then I'm shown a "This topic does not exist" page under URL
example.com/dw/Homepage...
I just don't know how the hell the rewrite rules work and I don't know what else could I do. I swear I tried a lot of things before bothering you folks.
My last attempt resulted in this cycle I've told you, and I got there by letting the uncommented
.htaccess file in my server's
example.com directory only, without any copy of it in the
/dw subdirectory.
Here is a copy of my
/dw/conf/local.php file (let me tell you, I tried every reasonable combination of values for basedir, baseurl, useslash and userewrite according to the docs):
<?php
/*
* Dokuwiki's Main Configuration File - Local Settings
* Auto-generated by config plugin
* Run for user: wikiadmin
* Date: Sun, 29 May 2016 18:34:45 -0300
*/
$conf['title'] = 'BrasiliaMinha';
$conf['start'] = 'Homepage';
$conf['lang'] = 'pt-br';
$conf['template'] = 'writr';
$conf['tagline'] = 'A história nas pequenas histórias';
$conf['recent'] = 40;
$conf['recent_days'] = 14;
$conf['useacl'] = 1;
$conf['superuser'] = '@admin';
$conf['userewrite'] = '1';
$conf['useslash'] = 1;
$conf['plugin']['discussion']['automatic'] = 1;
$conf['plugin']['discussion']['wikisyntaxok'] = 0;
$conf['plugin']['discussion']['newestfirst'] = 1;
$conf['plugin']['discussion']['visibilityButton'] = 1;
$conf['plugin']['tools']['show_tools'] = '2';
$conf['plugin']['tools']['show_link'] = '0';
$conf['plugin']['tools']['tools'] = 'email,pdf,bookcreator,print';
$conf['plugin']['tools']['skip_ids'] = 'playground,wiki:syntax';
$conf['plugin']['ckgedit']['scayt_lang'] = 'Brazilian Portuguese/pt_BR';
$conf['plugin']['publish']['hide_approved_banner'] = 1;
$conf['plugin']['bookcreator']['skip_ids'] = 'user,group,playground,wiki:syntax,wiki:ebook';
// end auto-generated content
And here is the
.htaccess file I have in my "domain root"
/example.com directory, the
/dw ancestor:
## Enable this to restrict editing to logged in users only
## You should disable Indexes and MultiViews either here or in the
## global config. Symlinks maybe needed for URL rewriting.
#Options -Indexes -MultiViews +FollowSymLinks
## make sure nobody gets the htaccess, README, COPYING or VERSION files
<Files ~ "^([\._]ht|README$|VERSION$|COPYING$)">
Order allow,deny
Deny from all
</Files>
## Uncomment these rules if you want to have nice URLs using
## $conf['userewrite'] = 1 - not needed for rewrite mode 2
RewriteEngine on
## Not all installations will require the following line. If you do,
## change "/dokuwiki" to the path to your dokuwiki directory relative
## to your document root.
RewriteBase /dw
RewriteRule ^_media/(.*) lib/exe/fetch.php?media=$1 [QSA,L]
RewriteRule ^_detail/(.*) lib/exe/detail.php?media=$1 [QSA,L]
RewriteRule ^_export/([^/]+)/(.*) doku.php?do=export_$1&id=$2 [QSA,L]
RewriteRule ^$ doku.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) doku.php?id=$1 [QSA,L]
RewriteRule ^index.php$ doku.php
## If you enable DokuWikis XML-RPC interface, you should consider to
## restrict access to it over HTTPS only! Uncomment the following two
## rules if your server setup allows HTTPS.
#RewriteCond %{HTTPS} !=on
#RewriteRule ^lib/exe/xmlrpc.php$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
Thank you very much for any suggestion!
Fabricio Rocha
Brasilia, Brazil