infinite loop problem

New to mod_rewrite? This is a good place to start.

infinite loop problem

Postby adn45 » Thu Oct 22, 2009 4:21 am

how can I fix this? I'm testing it on my local pc using xampp and it's causing the server to time out (firefox says "The page isn't redirecting properly...Firefox has detected that the server is redirecting the request for this address in a way that will never complete.":

Options +FollowSymLinks
RewriteEngine On
RewriteBase /testurl1/
RewriteRule ^(.*en.*)$ $1?language=en [L,R]
adn45
 
Posts: 4
Joined: Wed Oct 21, 2009 4:50 am

Postby richardk » Thu Oct 22, 2009 10:29 am

It happens because your RewriteRule matches the URL/path you are redirecting to.
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteBase /testurl1/

RewriteCond %{QUERY_STRING} ^(.*&)?language=en(&.*)?$ [NC]
RewriteRule ^(.*en.*)$ $1?language=en [R,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby adn45 » Thu Oct 22, 2009 12:23 pm

thanks
adn45
 
Posts: 4
Joined: Wed Oct 21, 2009 4:50 am

Postby richardk » Fri Oct 23, 2009 9:08 am

Code: Select all
^(.*&)?language=en(&.*)?$

should be
Code: Select all
!^(.*&)?language=en(&.*)?$
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby adn45 » Sat Oct 24, 2009 10:33 am

great, thanks for your help
adn45
 
Posts: 4
Joined: Wed Oct 21, 2009 4:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 13 guests

cron