Mobile app version of vmapp.org
Login or Join
Hamaas447

: How do I make SEO friendly URLs from my PHP pages? 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

@Hamaas447

Posted in: #Htaccess #ModRewrite #Php #Seo

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Hamaas447

1 Comments

Sorted by latest first Latest Oldest Best

 

@Phylliss660

You can find many tutos when you are searching over the web (or even more specifically on 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/

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme