Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: 301 redirect

  1. #1
    New Coder
    Join Date
    Jul 2005
    Location
    Michigan
    Posts
    93
    Thanks
    0
    Thanked 0 Times in 0 Posts

    301 redirect

    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...

    PHP Code:
     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.

  • #2
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Best method would be to use .htaccess.

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •