Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Usually I just use the online tools for url mod_rewrite rules but this just wouldn't work.

Dynamic url: http://sub.domain.com/index.php?page=index&name=test
Rewritten url: http://sub.domain.com/test OR http://sub.domain.com/test/
My htaccess:
RewriteRule ^([^/]+)/?$ index.php?page=index&name=$1 [L]

Instead of passing "test" for the variable name, I always get the value "index.php"

Anyone gurus has have any idea?

share|improve this question

1 Answer 1

RewriteRule ^(.*)/$ index.php?page=index&name=$1 [L]

Might be more what you're looking for.

Also, you can pre-condition the url for trailing slashes using something like:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !(.*)/$ %{REQUEST_URI}/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ index.php?page=index&name=$1 [L]
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.