Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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

OR

mydomain.com/somepage.html

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.