Page 1 of 1

ReWrite Pages

Posted: Tue Aug 11, 2009 4:59 am
by jigneshsoni
Hello Guys,
I have trouble with url re-writing,
I am new to php, for SEO purpose i want to change few of my site's pages from .php to .htm/.html

i want to change below four pages from .php to .htm
index.php, contact.php, aboutus.php, career.php
can you please help me to re-write above pages.

i have tried using below re-write script, but failed :(

RewriteEngine on

RewriteRule ^(.*)\.htm$ aboutus.php [NC]
RewriteRule ^(.*)\.htm$ index.php [NC]
RewriteRule ^(.*)\.htm$ contact.php [NC]
RewriteRule ^(.*)\.htm$ career.php [NC]


Also if you could suggest me some good books/links for rewrite rules

Re: ReWrite Pages

Posted: Tue Aug 11, 2009 11:03 am
by ct_lee
This code should work:

Code: Select all

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [nc]
If you then try to go to index.htm or aboutus.htm it will show the relevant php page. All you need to do is change the links in your pages so they link to .htm pages not .php pages.

Hope that helps.