Need help with .htaccess file and mod-rewrite?

Discussion in 'Apache' started by sajan1kota, Aug 1, 2010.

  1. #1
    Hi,

    i am able to access my website http://current-weather.info/ however when i enter the city name. I get an 500 internal server error. i have checked in the error logs and i found the below mentioned error message. I am hosting my site at godaddy , i have contacted the tech support and they are of no help and advised me to research on the internet i believe the problem is with .htaccess and i need to add some thing to the .htaccess file. I have not made any recent changes to the site.

    Error message : " [Sun Aug 1 02:21:47 2010] [error] [client 115.98.203.238] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary."

    contents of my .htaccess:

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule (.*) $1 [L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*)$ index.php?page=$1 [L]

    Thanks in advance.
     
    sajan1kota, Aug 1, 2010 IP
  2. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #2
    Try changing your .htaccess to
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*)$ index.php?page=$1 [L]
    
    Code (markup):
    You were telling it that if the file existed then use the file which results in a loop.
     
    Last edited: Aug 1, 2010
    tolra, Aug 1, 2010 IP
  3. sajan1kota

    sajan1kota Active Member

    Messages:
    186
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    50
    #3
    I have changed the .htaccess as advised still does work. i am getting the same error 500 internal server. anything else that you can think of ?
     
    sajan1kota, Aug 1, 2010 IP
  4. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #4
    Same error in the log file?

    What else is in .htaccess can you post the whole of it.
     
    tolra, Aug 1, 2010 IP
  5. sajan1kota

    sajan1kota Active Member

    Messages:
    186
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    50
    #5
    Yeah thats right same error in the log file and only the code that you have mentioned is in the .htaccess file.

     
    sajan1kota, Aug 1, 2010 IP
  6. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #6
    Try adding a RewriteBase to it so you have:
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*)$ index.php?page=$1 [L] 
    
    Code (markup):
     
    tolra, Aug 1, 2010 IP
  7. sajan1kota

    sajan1kota Active Member

    Messages:
    186
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    50
    #7
    thanks a ton. now its working , i just made a small change to the code that you have suggested .

    Once again thanks a lot.
     
    sajan1kota, Aug 1, 2010 IP