mod rewrite - What am I doing wrong?

Discussion in 'Apache' started by d4rkst4r, Jan 24, 2010.

  1. #1
    I put the following lines to my .htaccess and did some tests

    This works fine - browser goes to google (so I have mod rewrite working, right?)

    
    Options +FollowSymLinks
    Options +Indexes
    RewriteEngine on
    
    RewriteBase /
    
    RewriteRule old\.html http://www.google.com/
    
    Code (markup):
    But this does not - I get a 404: (I do have a "new.html" in the root directory)

    
    Options +FollowSymLinks
    Options +Indexes
    RewriteEngine on
    
    RewriteBase /
    
    RewriteRule old\.html new.html
    
    Code (markup):
    What am I doing wrong here? :confused:
     
    d4rkst4r, Jan 24, 2010 IP
  2. hostechsupport

    hostechsupport Well-Known Member

    Messages:
    413
    Likes Received:
    23
    Best Answers:
    7
    Trophy Points:
    138
    #2
    Hello,

    I could not see any domain name here
     
    hostechsupport, Jan 25, 2010 IP
  3. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #3
    When using below code - make sure the new.html actually exists!

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^old\.html$ new.html [L,R=301]
     
    hans, Jan 26, 2010 IP