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):
- Changed secure and unsecure base URLs in DB as shown at the top of this post (http and https)
- Changed resource URLs like CSS/JS and media in DB to use the base URL variables in curly braces
- Changed base URLs in app/etc/local.xml
- Ensured DB user, password and host address is correct
- Replaced all occurrences of live address to stage address in .htaccess
- In .htaccess tried commenting Rewrite Base, and uncommenting with "/" and "/stage/site/"
- Ensured .htaccess uses index.php as "DirectoryIndex"
- Disabled CSS and JS merging in DB
- Used
chown
on the entire devdomain to ensure everything works as it should - Used
chmod 755
on all directories andchmod 644
on all files andchmod 550
on the "mage" file - Used magento-cleanup.php
- Used magento-check.php (at first it was same as live, later after trying many things chmod() got forbidden to it for some reason)
- Used another short PHP script to get Mage::app and clear cache
- Removed /tmp/magento and /tmp/livedomain on server
- Restarted Apache on server
- Tried all the mentioned things on Chrome, Firefox, Vivaldi, Firefox Developer Edition and all their private browsing windows and clearing browser cache and cookies
- Enabled error display on index.php, but obviously I couldn't get anywhere near that since it kept redirecting
- Removing local.xml to try and trigger Magento install
- Removing .htaccess allowed any other PHP files to run, except index.php still redirects all the same
- Removing any parent directory .htaccess files (which only had Options -Indexes anyway)
- 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. - Reindexing through PHP on console
Please tell me what I could have possibly missed.