Jump to content


Photo

Avoid redirect loop?


  • Please log in to reply
5 replies to this topic

#1 sphinx

sphinx

    Advanced Member

  • Members
  • PipPipPip
  • 201 posts

Posted 19 May 2013 - 04:23 PM

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.

 

 

 

 

 



#2 requinix

requinix

    Transforming Moderator

  • Moderators
  • 6,061 posts
  • LocationWA

Posted 19 May 2013 - 05:43 PM

RewriteRule doesn't include the query string. Add a
RewriteCond %{QUERY_STRING} ^$


#3 sphinx

sphinx

    Advanced Member

  • Members
  • PipPipPip
  • 201 posts

Posted 20 May 2013 - 03:23 AM

Hi thanks for assistance.

 

However, it seems to redirect all of my links to ?1.

 

Thanks



#4 requinix

requinix

    Transforming Moderator

  • Moderators
  • 6,061 posts
  • LocationWA

Posted 20 May 2013 - 05:26 AM

What do you have now after merely adding what I posted into what you already had?

#5 sphinx

sphinx

    Advanced Member

  • Members
  • PipPipPip
  • 201 posts

Posted 20 May 2013 - 08:47 AM

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]

Edited by sphinx, 20 May 2013 - 08:48 AM.


#6 requinix

requinix

    Transforming Moderator

  • Moderators
  • 6,061 posts
  • LocationWA

Posted 20 May 2013 - 02:03 PM

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} ^$





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com