Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I moved my wiki from

http://jklatex.square7.de/wiki/doku.php/start

to

http://logicpuzzle.square7.de/start

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/(.*)$ http://logicpuzzle.square7.de/$1 [R,NC,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# 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/(.*)$ http://logicpuzzle.square7.de/$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
show 1 more comment

1 Answer

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/(.*)$ http://logicpuzzle.square7.de/$1 [R=301,NC,L]

works as desired.

share|improve this answer
add comment

Your Answer

 
discard

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.