Forum Moderators: phranque

Message Too Old, No Replies

Redirect problem

         

alphacooler

11:09 pm on Oct 8, 2005 (gmt 0)

10+ Year Member



I have a site that has 500 quality links with PR7. ALL links go to www.example.com/directory/. Up to this point there has been an "index.htm" file in that directory. That file has PR7.

I am now switching to a dynamic index.php page and need advice on how to do this.

Should I do a 301 re-direct from the .htm to .php?

I tried that with the following .HTACCESS file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
redirect 301 /directory/index.htm http://www.example.com/directory/index.php

This does not redirect the .htm file to the .php file. Any suggestions?

jd01

9:20 am on Oct 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If at all possible, rewrite, DO NOT REDIRECT.

If you redirect, *every* page on your site will be considered new. Even if you are only changing the extention.

I highly recommend you serve the php information to the htm extention, like this:

RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule ([^.]+)\.htm$ /$1.php [L]

If you need to, you could also use a query_string containing the page name, and pass it to the php file, so you get the correct information.

EG user requests /yourpage.htm

You could give them the information from /index.php?page=yourpage

Again, if at all possible, do not make any changes to the URLs

Hope this helps.

Justin