.htaccess question

Discussion in 'HTML & Website Design' started by ziplock122949, Jul 23, 2008.

  1. #1
    I need to switch a site over and many url's have changed. I also want all pages to redirect to the www. version of the page. Will the following code work or do I need to do something else?

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^example.com
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]
    Redirect 301 /contact.html http://www.example.com/contact.php
    Redirect 301 /links/websitetools.html http://www.example.com/links/website-tools.php
    PHP:

     
    ziplock122949, Jul 23, 2008 IP
  2. ziplock122949

    ziplock122949 Active Member

    Messages:
    159
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Anyone know how to fix this file? Firefox is saying it is redirecting in a way that will never complete.
     
    ziplock122949, Aug 22, 2008 IP
  3. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Dodger, Aug 22, 2008 IP
  4. ziplock122949

    ziplock122949 Active Member

    Messages:
    159
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I am a little confused by that. I am not quite sure how it can help since the site has a bunch of .html pages that are being moved to different locations along with changing to .php
     
    ziplock122949, Aug 26, 2008 IP
  5. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #5
    All I was saying, is to keep the .html extension without redirects. You can still process an .html page as PHP.

    An extensive redirect list in .htaccess can put more strain on the server. And you will have to maintain the list if there any external links pointing to those pages.
     
    Dodger, Aug 26, 2008 IP