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

Trying to get SEO Friendly URLs to work for my website using the following htaccess:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^explore/(.*)$ index.php?page=explore&type=$1
RewriteRule ^(.*)$ index.php?page=$1

E.g. it should load /index.php?page=test for /test/ and /index.php?page=explore&type=1 for /explore/1.

However it's not working, does anyone know how I could get this to work?

share|improve this question

migrated from stackoverflow.com Nov 18 '13 at 20:26

This question came from our site for professional and enthusiast programmers.

up vote 3 down vote accepted
  1. You have RewriteEngine On missing
  2. RewriteCond are only applicable to next immediate RewriteRule

Try this code:

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^explore/(.*)$ index.php?page=explore&type=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1 [L]
share|improve this answer
I would have said the QSA and NC flags should only be used if required. There does not appear to be anything in the question that suggests these would be needed. (This seems to be the result of an edit by "Community"?) – w3dk Nov 18 '13 at 21:15

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.