Quick htaccess question

Discussion in 'Apache' started by hasen, Jan 27, 2009.

  1. #1
    I know how to redirect domain.com/index.php to domain.com using this code:

    
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://www.domain.com/ [R=301,L]
    
    Code (markup):
    But how do I make it redirect domain.com/index.php/anything/ to domain.com ?

    Thanks in advance.
     
    hasen, Jan 27, 2009 IP
  2. hasen

    hasen Peon

    Messages:
    994
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Its alright I solved it myself through a combination of trial and error and educated guesses. It works apart from it can't redirect to domain.com if there is a ? in the URL somewhere. Anyway, the code if anyone is interested or found this through search is:

    
    RewriteEngine On
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php(.*)\ HTTP/
    RewriteRule ^index\.php(.*)$ http://www.domain.com/ [R=301,L]
    
    Code (markup):
     
    hasen, Jan 27, 2009 IP