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'm pretty new to this and was wondering how to turn my site URLs into SEO friendly URLs using .htaccess and mod_rewrite?

My URLs take the form mydomain.com/index.php?pid=1&pagename=Some Page

I would like it be mydomain.com/Some Page



I know this is possible with mod_rewrite and .htaccess, but I'm having trouble finding an exact answer on how to accomplish this?

share|improve this question
Check out this link zenverse.net/seo-friendly-urls-with-htaccess – Codex73 Mar 30 '12 at 1:36

You can find many tutos when you are searching over the web (or even more specifically on http://www.stackoverflow.com).

For instance, you can find this good tutorial.

Namely, you have to use conditions RewriteCond (one or more) and then add the rewriting you want to do with RewriteRule.

For instance, let say you want to redirect users to another domain (this is a dummy example, there are probably better ways to handle this):

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} !^/HTML2/
RewriteRule ^(.*)$ /HTML2/$1
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.