Header Shadow Image


Page keeps redirecting from http://localhost to http://www.mysites.com with a permanent 301 redirect.

So while making a copy of my page for testing purposes, I try to run it from my LAMP configuration only to receive a redirect to my online page.  Tinkering with the .htaccess file did absolutely nothing in this case.  Page keeps redirecting from http://localhost/wordpress to http://www.microdevsys.com/WordPress with a line like this in the /var/log/httpd/access_log file:

127.0.0.1 – - [13/Oct/2012:23:23:23 -0400] "GET /wordpress/ HTTP/1.1" 301 128 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.4) Gecko/20100622 Fedora/3.6.4-1.fc13 Firefox/3.6.4 GTB7.1"

in the apache error_log / access_log files.  Doing a bit of digging in the imported database, we find that the home option is set to our main site, which will redirect to http://www.mysite.com. 

Nothing to do with .htaccess after all and alot to do with the wp_options table:

mysql> select * from wp_options where option_value like "%microdev%" and option_name = "home";
+———–+———+————-+————————————–+———-+
| option_id | blog_id | option_name | option_value                         | autoload |
+———–+———+————-+————————————–+———-+
|        40 |       0 | home        | http://www.microdevsys.com/WordPress | yes      |
+———–+———+————-+————————————–+———-+
1 row in set (0.00 sec)

mysql>

A quick update and the issue is resolved:

mysql> update wp_options set option_value="http://localhost/wordpress" where option_value like "%microdev%" and option_name = "home";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from wp_options where option_value like "%microdev%" and option_name = "home";
Empty set (0.00 sec)

mysql> select * from wp_options where option_value like "%localhost%" and option_name = "home";
+———–+———+————-+—————————-+———-+
| option_id | blog_id | option_name | option_value               | autoload |
+———–+———+————-+—————————-+———-+
|        40 |       0 | home        | http://localhost/wordpress | yes      |
+———–+———+————-+—————————-+———-+
1 row in set (0.00 sec)

mysql>

and now http://localhost/wordpress no longer redirects to your online page.  If it still doesn't work, change the following siteurl entry as well:

mysql> select * from wp_options where option_value like "%microdevsys.com%" and option_name = "siteurl";
+———–+———+————-+——————————-+———-+
| option_id | blog_id | option_name | option_value                  | autoload |
+———–+———+————-+——————————-+———-+
|         1 |       0 | siteurl     | http://www.microdevsys.com/wp | yes      |
+———–+———+————-+——————————-+———-+
1 row in set (0.00 sec)

mysql>

and update similarly too:

mysql> select * from wp_options where option_value like "%microdevsys.com%" and option_name = "siteurl";
+———–+———+————-+——————————-+———-+
| option_id | blog_id | option_name | option_value                  | autoload |
+———–+———+————-+——————————-+———-+
|         1 |       0 | siteurl     | http://www.microdevsys.com/wp | yes      |
+———–+———+————-+——————————-+———-+
1 row in set (0.00 sec)

mysql>

mysql> update wp_options set option_value="http://localhost/wp" where option_value like "%microdev%" and option_name = "siteurl";
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

mysql>

mysql> select * from wp_options where option_value like "%microdevsys.com%" and option_name = "siteurl";
Empty set (0.00 sec)

mysql> select * from wp_options where option_value like "%localhost%" and option_name = "siteurl";
+———–+———+————-+—————————-+———-+
| option_id | blog_id | option_name | option_value               | autoload |
+———–+———+————-+—————————-+———-+
|         1 |       0 | siteurl     | http://localhost/wp        | yes      |
+———–+———+————-+—————————-+———-+
1 row in set (0.00 sec)

mysql>

And you should be good to view your site from your own URL.  If the above still doesn't work, stop HTTPD, MYSQLD then clear your cache and cookies from your browser.  Then try again.  At this point, it worked for me so I suspect it'll work for you as well.  Good Luck!

Cheers,
TK

Leave a Reply

 


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License