Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 have the following in my .htaccess file:

<Directory /home/eamorr/sites/>
                Options Indexes FollowSymLinks MultiViews
                Options -Indexes
                AllowOverride all
                Order allow,deny
                allow from all

                RewriteEngine on
                RewriteRule ^([^/.]+)/?$ index.php?uname=$1 [R,L]

When I go to, appears in the address bar!

But I want to appear in the address bar!!!

(I need to parse the URL in javascript in index.php)

share|improve this question

marked as duplicate by Jenny D, Andrew Schulman, kasperd, Ward, HBruijn Oct 3 '14 at 13:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 2 down vote accepted

<Directory> directive can be only used in server config or virtual host, not in .htaccess file.

If you use:

RewriteRule ^([^/.]+)/?$ index.php?uname=$1 [R,L]

the per-directory prefix (/home/eamorr/sites/ is automatically added to the substitution. So remove the <Directory> directive and put a slash at the begining:

RewriteEngine on
RewriteRule ^([^/.]+)/?$ /index.php?uname=$1 [R,L]

it will work as you expect.

share|improve this answer
Thanks so much for that. I'm totally clueless when it comes to anything other than bog standard Apache rules... – Eamorr Sep 8 '11 at 15:19

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