Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Test site redirects to live site’s home page
 
Birf
Jr. Member
 
Total Posts:  23
Joined:  2011-11-04
 

Hi,

My developer switched the secure base URL to https//.test.domain.com (it was the http version before). Now the test domain redirects to the live domain home page (http://domain.com) when I attempt to checkout.

We temporarily fixed the issue by taking the secure base URL back to http. But we need to fix the underlying problem at some point. Anyone have experience with this kind of issue?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

Magento on new server redirects to old server, still points to old server after using phpMyAdmin to change Base URLs, and may even still redirect to old server after cleaning out the Magento cache.

Yep, been there, done that…

To make changes in core configurations and have them stick (local.xml, base urls, etc.) you need to clear your Magento code cache, often by actually manually deleting the mage--? subfolders in var/cache.

Cached configuration can cause all sorts of headaches including having the base urls still pointing back to the original Magento installation (different folders, different server) despite the fact that you can use phpMyAdmin and see that the rows have been updated in the database. Configuration will not be reread from the database until the cached configuration information is deleted.

Another place where stuff gets stuck is in your APC op-code cache if you’re using it. Use the apc.php administration page to clear that as well.

And last of all, IF YOU DO NOT HAVE PERMISSIONS SET PROPERLY ON var/cache AND var/tmp SO THEY’RE BOTH READABLE AND WRITEABLE TO YOUR WEB SERVER, Magento may store the cached information in the system /tmp directory which means that no amount of clearing Magento’s cache will make the cached configs go away until someone reboots the server, the system /tmp directory gets cleared and Magento seemingly automagically reads its configs. See images below, carefully read the directory paths in the top bar, notice that they are in the system temp, not in Magento’s var/cache off its home directory.

In this case, you will need to clear the cache Magento has created in /tmp. Look for /tmp/var/cache/* or /tmp/magento/var/cache/* or similar. Also there will be Zend* files stored there. They will have to be deleted. If you are managing your own server, this is quite simple, if not, you will need your hosting provider to hunt them down and delete them. See the images below for their location as noted in a live situation where this redirect was happening.

Set your var/ folder structure to chmod 777 to prevent this from happening. In fact, when transferring Magento from one server to another, the first thing after restoring the files should be a sweep through the files setting the permissions after which chmod -R 777 both var/ and media/.

Image Attachments
Magento folder put in temp.PNGMagento Cache written to temp.PNG
 
Magento Community Magento Community
Magento Community
Magento Community
 
interplex
Jr. Member
 
Total Posts:  3
Joined:  2010-06-03
 

I had the same problem and simply could not find the solution for days! My test-domain (which was a duplicate of the live domain) randomly redirected to the live-domain and vice versa, allthough I had taken all the well-known steps like changing BaseURL, clearing var and /tmp etc. Chiefairs post gave me the important hints: First I thought it was the cached files in systems /tmp due to bad permissions of /var and /tmp of my magento-installation. A restart of my managed server seemed to make all problems go away: The live-domain worked without any redirects. But as soon as I opened the test-domain in the browser, everything went haywire again, although meanwhile I had doublechecked all the permissions.
Still, I found the solution in chiefairs post after reading it a second time: The apc cache! In app/etc/local.xml, I found the following code:

<cache>
            <
backend>apc</backend>
            <
prefix>Mage_</prefix>
 </
cache>

The <prefix> was the problem. It has to be unique for each store you run on the same server. When duplicating the live-domain, I had not assigned a unique prefix to the test-domain; so both - live and test - shared the same apc cache which caused the redirects.
So I changed the local.xml to

<cache>
            <
backend>apc</backend>
            <
prefix>Live_</prefix>
 </
cache>

for the live-domain and

<cache>
            <
backend>apc</backend>
            <
prefix>Dev_</prefix>
 </
cache>

for the test-domain. Magically, without any sever-restarts, all the redirects disappeared, everything works just fine!
Hope this is of help for people running into he same problem…

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

Thank you for posting that. The APC storage needs that prefix in place not only for separating Magento instances, but also if you’re running a CMS like Joomla beside the Magento install.

Currently I run a separate remote dev environment, but there is a day coming when I will create a staging environment on the live server. And the APC cache is a vital speed tool. I won’t be running around in circles pulling my hair out.

Not sure how this relates to other caching mechanisms like memcache, but keeping the two Magento installations separate in their cache storage is probably a really necessary item.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top