1
votes

Just a day ago my staging copy of our production website was working perfectly. I see no connection with anything that happened since then that could cause this.

  • Live site: http://www.domain.co.uk/
  • Stage site: http://devdomain.com/stage/site/

Both of these domains are on the same server, each a separate Magento installation with only one store. Database was dumped from live using mage-dbdump.sh of Sonassi.

At first I noticed the site completely redirects to our live site no matter what URL. After fixing a few things I noticed I can then run any PHP file other than the index.php of Magento, which always does a 302 redirect to live site according to Firebug Net tab. (First header is for stage/site 302 Found, second one is live site 200 OK)

Several more fixing attempts later and it redirects to live site no matter what without even saying in the Firebug Net tab that it redirected.

Here is the list of things I have done trying to fix it (might have forgotten some by now):

  1. Changed secure and unsecure base URLs in DB as shown at the top of this post (http and https)
  2. Changed resource URLs like CSS/JS and media in DB to use the base URL variables in curly braces
  3. Changed base URLs in app/etc/local.xml
  4. Ensured DB user, password and host address is correct
  5. Replaced all occurrences of live address to stage address in .htaccess
  6. In .htaccess tried commenting Rewrite Base, and uncommenting with "/" and "/stage/site/"
  7. Ensured .htaccess uses index.php as "DirectoryIndex"
  8. Disabled CSS and JS merging in DB
  9. Used chown on the entire devdomain to ensure everything works as it should
  10. Used chmod 755 on all directories and chmod 644 on all files and chmod 550 on the "mage" file
  11. Used magento-cleanup.php
  12. Used magento-check.php (at first it was same as live, later after trying many things chmod() got forbidden to it for some reason)
  13. Used another short PHP script to get Mage::app and clear cache
  14. Removed /tmp/magento and /tmp/livedomain on server
  15. Restarted Apache on server
  16. Tried all the mentioned things on Chrome, Firefox, Vivaldi, Firefox Developer Edition and all their private browsing windows and clearing browser cache and cookies
  17. Enabled error display on index.php, but obviously I couldn't get anywhere near that since it kept redirecting
  18. Removing local.xml to try and trigger Magento install
  19. Removing .htaccess allowed any other PHP files to run, except index.php still redirects all the same
  20. Removing any parent directory .htaccess files (which only had Options -Indexes anyway)
  21. Installing a fresh Magento website and configuring in the same way as the stage site, but in http://devdomain.com/stage/magento/ and using the same .htaccess as the stage site (replacing all occurrences of "/stage/site/" with "/stage/magento/"). This worked fine.
  22. Reindexing through PHP on console

Please tell me what I could have possibly missed.

1

1 Answers

0
votes

Chrome caches redirects:

https://superuser.com/questions/304589/how-can-i-make-chrome-stop-caching-redirects

(even though you said you cleared the cache.)

You can also change the base URL on fresh installation to point to the old staging URL, after moving your old staging app to another directory, and verify if the redirection still happens.