Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I moved my wiki from


and now i want to redirect the URL with mod_rewrite. My .htaccess is as follows:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/wiki/doku.php/(.*)$$1 [R,NC,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

I don't understand why it does not work :-(

Any hints?

share|improve this question
Are you definitely using an Apache server? If not, .htaccess may not even be in use. If you rename .htaccess, does your site break? – zigojacko Mar 29 '13 at 11:04
Yes, the server is Apache/2.4 and according to the forum mod_rewrite is active. – Josef Mar 29 '13 at 11:42
After renaming to .htaccess2 nothing special happens. Why should this break the page? – Josef Mar 29 '13 at 11:54
Got it! The problem is the leading slash. RewriteRule ^wiki/doku.php/(.*)$$1 [R,NC,L] works. – Josef Mar 29 '13 at 12:19
@Josef: Glad you got it resolved. You can put that as an answer (below) and accept it. That way, others will see that the question has been answered (and you have a chance of getting more rep). – w3d Mar 29 '13 at 12:52

1 Answer 1

up vote 1 down vote accepted

The leading slash is evil! ;-) The slash is part of RewriteBase.

Changing the RewriteRule to

RewriteRule ^wiki/doku.php/(.*)$$1 [R=301,NC,L]

works as desired.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.