Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
BTW, the manual: mediawiki.org/wiki/Manual:Short_URL – Nemo Apr 6 '15 at 8:45

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. – w3dk 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
Remove the slash at the start of the pattern. ^/liam$ becomes ^liam$. (In .htaccess files the directory prefix is removed when pattern matching.) – w3dk Jan 15 '13 at 11:41
@w3d Oops! Grumble, grumble need moar coffee, grumble. – JCL1178 Jan 15 '13 at 16:00

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.