Magento Forum

   
Site keeps redirecting to old link
 
srmobile
Sr. Member
 
Total Posts:  276
Joined:  2011-10-25
 

Hello,

I’ve moved one of my magento sites to a new server and at the same time, changed the location of the files.

Example: www.magentowebsite.com/magento became www.magentowebsite.com

I’ve cleared the cache, gone through the local.xml ect and could not find any references.

When I go to www.magentosite.com it redirects to the old /magento.

I ended up doing a chmod 777 to the entire site and it finaly worked (stoped redirecting), however when I set the correct recommended permissions of 644 and 755 it begins to redirect again.

Any idea on where I should look?

Thanks,

SR

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

Answered over here.

While doing a system wide reset of all your file and directory permissions is needed as you have done, there are some other settings needed as well. Here are the recommended settings.

You are probably running DSO, notice the extension on the second set of recommended settings. Your problem comes from the var/ and media/ folders needing to be chmod -R 777 so the web server can actually write to them. 777 on these folders is perfectly ok, Magento installs .htaccess files in them to protect the server from world write if you haven’t modified the .htaccess files.

When Magento cannot write to its var/cache and var/tmp folders, it will write to folders in /tmp as a temporary cache till you get the permissions set. It’s redirecting to the old site because the permissions are forcing it to read its cache and temps from /tmp/?/var/cache/* and /tmp/?/var/tmp/* and Magento probably got started at least once with the previous site’s baseurls and with wrong permissions and the config got cached there.

 
Magento Community Magento Community
Magento Community
Magento Community
 
srmobile
Sr. Member
 
Total Posts:  276
Joined:  2011-10-25
 

The permissions on those directories did the trick.

Once again thank you!

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

You’re welcome!

The first time I had it happen, I did a very Windows thing, rebooted the server and the problem went away. After a little discussion here on the forums, we realized that the /tmp folder gets cleaned on restart (*nix). Sure enough, tried it with wrong URLs and funky directory/file permissions, went to /tmp and there was this zoo of cache directories and Zend stuff living there.

I now shut down Apache on the .dev server until I’ve dropped, recreated and restored the Magento database, run a script on the Magento database to reset base URLs, restore the Magento application, set permissions to be correct, make a correction to .htaccess and swap the local.xml for one with .dev settings. Only after this do I start Apache as Magento should be in a known good environment with its cache folders writable.

This prevents cron or an act of starting Magento from creating mayhem as it runs without proper permissions, errors out, and caches bad config information to /tmp before it has been set up to run on .dev.

It’s an issue any time Magento has been moved, the base URLs are different and the web server can’t write out its cache to the right location.

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