Rewrite / redirect problem

Discussion in 'Apache' started by freerollers, Aug 2, 2008.

  1. #1
    I have made code for a page to work as .html in the ur with this code.

    RewriteRule ^page.html$ page.php
    Code (markup):
    the .php page is indexed on search engines and linked on some sites, sure it still works but it would make two different addresses for same page, but not so SEO-friendly?

    I tried to add this,
    redirect 301 /page.php http://www.host.com/page.html
    Code (markup):
    so the .php would be redirected, but it seems it didn't work and firefox reports thats its a endeless loop, could anyone help me getting this work please?
     
    freerollers, Aug 2, 2008 IP
  2. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #2
    Try this code:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^.*page.php$ [NC]
    RewriteRule .* page.html [R=301,L,QSA]
    RewriteRule ^page.html$ page.php
     
    buldozerceto, Aug 2, 2008 IP