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'd like to rewrite /liam to /index.php/Liam_Edwards-Playne. I've currently written this below in the appropriate .htaccess file but it is still returning a 404:

RewriteEngine On
RewriteRule ^/liam$ %{DOCUMENT_ROOT}/index.php/Liam_Edwards-Playne [NC,L]
share|improve this question
add comment

1 Answer

You shouldn't need the DOCUMENT_ROOT variable. Simply doing:

RewriteRule ^liam$ /index.php/Liam_Edwards-Playne [NC,L]

is sufficient for mod_rewrite

share|improve this answer
    
+1 Just to add, %{DOCUMENT_ROOT} could perhaps be used as part of the substitution in a server (virtualhost) context, but in a directory (.htaccess) context the substitution path must be relative to the DOCUMENT_ROOT, so it should be omitted. –  w3d Jan 15 '13 at 8:18
    
It's not working, still getting a 404. –  liamzebedee Jan 15 '13 at 10:06
    
Double check that mod_rewrite is enabled. –  joesk Jan 15 '13 at 11:11
1  
Remove the slash at the start of the pattern. ^/liam$ becomes ^liam$. (In .htaccess files the directory prefix is removed when pattern matching.) –  w3d Jan 15 '13 at 11:41
    
@w3d Oops! Grumble, grumble need moar coffee, grumble. –  JCL1178 Jan 15 '13 at 16:00
show 1 more 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.