Weird mod_rewrite errors.

Discussion in 'Apache' started by argothiusz, Jun 9, 2008.

  1. #1
    Here is my code

    RewriteEngine On
    RewriteBase /
    RewriteRule ^indextest /indextest.php
    RewriteCond %{HTTP_HOST} !^www\.site\.net
    RewriteRule ^.*$ http://www.site.net%{REQUEST_URI} [R=301,L]
    PHP:
    It works and redirect site.com to www.site.com but the rewriterule of changing indextest.php to indextest doesn't work.

    Any one know why? thanks
     
    argothiusz, Jun 9, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Have you tried:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^indextest /indextest.php [R=301,L]
    RewriteCond %{HTTP_HOST} !^www\.site\.net
    RewriteRule ^.*$ http://www.site.net%{REQUEST_URI} [R=301,L]
    Code (markup):
     
    jayshah, Jun 10, 2008 IP
  3. argothiusz

    argothiusz Well-Known Member

    Messages:
    1,500
    Likes Received:
    79
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Yup, Tried that and it doesn't work :(
     
    argothiusz, Jun 10, 2008 IP
  4. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #4
    Oh, wait:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^/indextest /indextest.php [R=301,L]
    RewriteCond %{HTTP_HOST} !^www\.site\.net
    RewriteRule ^.*$ http://www.site.net%{REQUEST_URI} [R=301,L]
    Code (markup):
     
    jayshah, Jun 11, 2008 IP