| Author | 
  | 
dejudicibus
 
 
  Joined: 21 Dec 2011 Posts: 6 Location: Rome, Italy (EU)
  | 
 Posted: Thu 22 Dec '11 1:03    Post subject: Accessing by localhost gives diff result than 127.0.0.1 | 
     | 
 
  | 
 
I am experimenting a strange behavior. I have a WampServer environment on which I installed WordPress on my local PC. When I load the main file of my blog, that is, http://localhost:8080/wordpress/index.php, I get from Chrome and Firefox an error 301 message about too many redirect, or redirect loop. Note that I use 8080 port to avoid conflict with Skype. However, if I load ANY OTHER page of blog, I have no problems. I spent a lot trying to troubleshoot this problem: I looked at .htaccess file, cleared the cache, change wordpress code... I tried mostly any suggestion I found on web about similar problems. No way. However, it is not that what surprised me, but the fact that, when I loaded http://127.0.0.1:8080/wordpress/index.php everything worked fine! In fact, the same blog, when published on the web on a real domain, works fine. Now, I know that localhost IS NOT exactly 127.0.0.1  since the former use windows sockets whereas the latter only TCP/IP, but I do not really understand why that affect redirects....   Any idea? I cannot find anything in httpd.conf that could be relate dto that... | 
 
  | 
| Back to top | 
 | 
glsmith Moderator
  
  Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
  | 
 Posted: Thu 22 Dec '11 4:28    Post subject:  | 
     | 
 
  | 
 
| localhost on Win Vista & up is typically ::1 ipv6, this could be why if the WAMP is not IPv6 capable. | 
 
  | 
| Back to top | 
 | 
dejudicibus
 
 
  Joined: 21 Dec 2011 Posts: 6 Location: Rome, Italy (EU)
  | 
 Posted: Thu 22 Dec '11 21:51    Post subject:  | 
     | 
 
  | 
 
 	  | glsmith wrote: | 	 		  | localhost on Win Vista & up is typically ::1 ipv6, this could be why if the WAMP is not IPv6 capable. | 	  
 
 
I have the problem on both XP and Vista. It is not related to IPv6. | 
 
  | 
| Back to top | 
 | 
dejudicibus
 
 
  Joined: 21 Dec 2011 Posts: 6 Location: Rome, Italy (EU)
  | 
 Posted: Thu 22 Dec '11 21:52    Post subject:  | 
     | 
 
  | 
 
 	  | glsmith wrote: | 	 		  | localhost on Win Vista & up is typically ::1 ipv6, this could be why if the WAMP is not IPv6 capable. | 	  
 
 
Please, note that the problem is related only to REDIRECT LOOP on MAIN page. I have no problem to use localhost on any other page, even of the same blog. | 
 
  | 
| Back to top | 
 | 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7442 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Sun 25 Dec '11 17:05    Post subject:  | 
     | 
 
  | 
 
 	  | dejudicibus wrote: | 	 		  
 
Please, note that the problem is related only to REDIRECT LOOP on MAIN page. I have no problem to use localhost on any other page, even of the same blog. | 	  
 
 
I guress the redirect is caused by wordpress. Cause you have to enter a domain name in the backend and wordpress tries to switch to that url. I had that problem too, when I switched from www.example.com to example.com    
 
I think there is plugins that allows multiple domain name in wordpress. Else you have to work with the url of your choise. | 
 
  | 
| Back to top | 
 | 
dejudicibus
 
 
  Joined: 21 Dec 2011 Posts: 6 Location: Rome, Italy (EU)
  | 
 Posted: Mon 26 Dec '11 0:38    Post subject:  | 
     | 
 
  | 
 
 	  | James Blond wrote: | 	 		  I guress the redirect is caused by wordpress. Cause you have to enter a domain name in the backend and wordpress tries to switch to that url. I had that problem too, when I switched from www.example.com to example.com    
 
I think there is plugins that allows multiple domain name in wordpress. Else you have to work with the url of your choise. | 	  
 
 
Well, sure! I *KNOW* that redirect is caused by a WordPress plugin. I also know which one: qTranslate. I wonder why the problem occurs
 
 
1. only with index.php
 
2. only on localhost (not on domain)
 
3. only with Firefox and Chrome, but not with Opera
 
4. only with localhost:8080 but NOT with 127.0.0.1:8080
 
 
I suspect I could setup my Apache config to vaoid that. PS Do not tell me to get through with qTranslate: I won't   | 
 
  | 
| Back to top | 
 | 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7442 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Mon 26 Dec '11 14:02    Post subject:  | 
     | 
 
  | 
 
I have no expenrience with qTranslate.
 
 
Well I'm not a wordpress hacker. What do you mean by only index.php? Do you use the rewriting with .htaccess file? | 
 
  | 
| Back to top | 
 | 
dejudicibus
 
 
  Joined: 21 Dec 2011 Posts: 6 Location: Rome, Italy (EU)
  | 
 Posted: Mon 26 Dec '11 19:50    Post subject:  | 
     | 
 
  | 
 
 	  | James Blond wrote: | 	 		  I have no expenrience with qTranslate.
 
 
Well I'm not a wordpress hacker. What do you mean by only index.php? Do you use the rewriting with .htaccess file? | 	  
 
 
I use the standard WordPress-generated .htaccess. By ONLY INDEX.PHP I mean that the problem occurs only on coverpage, not with any other page of blog, and only if I use localhost. If I use 127.0.0.1 or on remote domain, no problem. I suspect there is a problem of "lack of communications" between Apache and the Windows socket that does not exist if I use TCP/IP directly, but I am not so expert of httpd demons to understand which one. | 
 
  | 
| Back to top | 
 | 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7442 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Mon 26 Dec '11 20:47    Post subject:  | 
     | 
 
  | 
 
That scenario is a bit weired to me.
 
Condtion: url is / and host is localhost.
 
result: it fails
 
 
Condition: url is /whatever and host is localhost
 
result: it works
 
 
I need to know more. Which apache version and where downloaed? 
 
 
 	  | Quote: | 	 		  
 
REDIRECT LOOP on MAIN
 
 | 	  
 
 
Which error message do you get in your browser? What happens in that time in the error log and the access log? | 
 
  | 
| Back to top | 
 | 
dejudicibus
 
 
  Joined: 21 Dec 2011 Posts: 6 Location: Rome, Italy (EU)
  | 
 Posted: Mon 26 Dec '11 21:40    Post subject:  | 
     | 
 
  | 
 
 	  | James Blond wrote: | 	 		  That scenario is a bit weired to me.
 
Condtion: url is / and host is localhost.
 
result: it fails
 
 
Condition: url is /whatever and host is localhost
 
result: it works
 
 
I need to know more. Which apache version and where downloaed? 
 
 
 	  | Quote: | 	 		  
 
REDIRECT LOOP on MAIN
 
 | 	  
 
 
Which error message do you get in your browser? What happens in that time in the error log and the access log? | 	  
 
 
FAILS FOR
 
 
url is / && localhost
 
 
WORKS FOR
 
 
url is / && 127.0.0.1
 
url is / && myblog.com
 
url is /whatever && (localhost|127.0.0.1|myblog.com)
 
 
I use the latest version of WampServer, 2.2, that is:
 
 
Apache Version : 2.2.21  
 
PHP Version : 5.3.8  
 
 
MSG is Too Many Redirects | Redirect Loop
 
access.log show no problem, but there are too many 302 like this
 
 
127.0.0.1 - - [16/Dec/2011:18:21:49 +0100] "GET /wordpress/it HTTP/1.1" 302 - | 
 
  | 
| Back to top | 
 |