sphinx Posted May 19, 2013 Share Posted May 19, 2013 Hi, I'm using the 'isset' functions for my pages. I want to redirect. http://website.co.uk to http://website.co.uk/?1 I'm using this: RewriteEngine on RewriteCond %{HTTP_HOST} ^website\.co\.uk$ [OR] RewriteCond %{HTTP_HOST} ^www\.website\.co\.uk$ RewriteRule ^/?$ "http\:\/\/website\.co\.uk\/\?1" [R=301,L] I'm getting a redirect loop error. Is there a way to bypass this? Thank you. Link to comment https://forums.phpfreaks.com/topic/278185-avoid-redirect-loop/ Share on other sites More sharing options...
requinix Posted May 19, 2013 Share Posted May 19, 2013 RewriteRule doesn't include the query string. Add a RewriteCond %{QUERY_STRING} ^$ Link to comment https://forums.phpfreaks.com/topic/278185-avoid-redirect-loop/#findComment-1431072 Share on other sites More sharing options...
sphinx Posted May 20, 2013 Author Share Posted May 20, 2013 Hi thanks for assistance. However, it seems to redirect all of my links to ?1. Thanks Link to comment https://forums.phpfreaks.com/topic/278185-avoid-redirect-loop/#findComment-1431126 Share on other sites More sharing options...
requinix Posted May 20, 2013 Share Posted May 20, 2013 What do you have now after merely adding what I posted into what you already had? Link to comment https://forums.phpfreaks.com/topic/278185-avoid-redirect-loop/#findComment-1431135 Share on other sites More sharing options...
sphinx Posted May 20, 2013 Author Share Posted May 20, 2013 RewriteEngine on RewriteCond %{QUERY_STRING} ^$ RewriteCond %{HTTP_HOST} ^website\.co\.uk$ [OR] RewriteCond %{HTTP_HOST} ^www\.website\.co\.uk$ RewriteRule ^/?$ "http\:\/\/website\.co\.uk\/\?1" [R=301,L] Link to comment https://forums.phpfreaks.com/topic/278185-avoid-redirect-loop/#findComment-1431167 Share on other sites More sharing options...
requinix Posted May 20, 2013 Share Posted May 20, 2013 I believe what you have now translates as (empty query string && website.co.uk) || (www.website.co.uk)so try RewriteCond %{HTTP_HOST} ^website\.co\.uk$ [OR] RewriteCond %{HTTP_HOST} ^www\.website\.co\.uk$ RewriteCond %{QUERY_STRING} ^$ Link to comment https://forums.phpfreaks.com/topic/278185-avoid-redirect-loop/#findComment-1431232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.