View Full Version : 301 redirect

10-30-2006, 07:23 PM
Hello All,

I recently redesign my works website. While doing this, I used php for every page. The old site was built on a html platform. I submitted everything to the search engines but all of my links are going to the old .html files.

I did some research and found that I could use a 301 redirect. I'm a little confused though because all I can find are php, asp, and asp net examples. These would work find but the pages that I need to redirect all have html extensions. Do I still use something like a php redirect script even if the extension is html?

Below is the code I can use for a php redirect...

Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );

If I was moving from a .php extension to another .php extension, it would make sense, but can I use something like the above code in a .html page?

Thanks in advance.

10-30-2006, 07:36 PM
Best method would be to use .htaccess (http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html).

RewriteEngine on
Options +FollowSymlinks
RewriteRule old.html$ /new.php [R=301,L]