Page 1 of 1

[Solved] Interesting 404 problems after moving site

Posted: Thu Feb 11, 2010 4:40 pm
by Gatsu000
We have some interesting 404 problems that we are stumped on. We currently are moving all of our sites from various hosters into our own Linux box. We have moved 6 sites. Every single site has been moved over and is working just fine once we move it over. We are having problems with 1 site though.

we have a perfect file transition and we move the database over successfully. We get a 404 error on every page (including the landing) We have tried a few things to resolve this.

Disable SEF URL's (Does nothing)
Change templates (Does nothing)

The only difference this site has from all the others is that it is the main site on our servers that uses named based virtual hosting. So it is the primary VHost.

Does anyone have any suggestions?

Re: Interesting 404 problems after moving site

Posted: Thu Feb 11, 2010 7:16 pm
by toivo
Have you set the $live_site variable in configuration.php to the full URL of the Joomla site? It helps getting the default virtual host site to present the correct URL if domains that do not have a corresponding virtual host point to the site.

Re: Interesting 404 problems after moving site

Posted: Fri Feb 12, 2010 5:56 pm
by raghavtomar
@Gatsu000: Yes, entering your site address (e.g. http://domain.com) in $live_site variable solves such problems but my question here is to toivo...
@toivo: You seem to know about this concept. What does this variable do and how come changing its value makes the site work? (Its worked for everyone of my sites)

Re: Interesting 404 problems after moving site

Posted: Fri Feb 12, 2010 8:19 pm
by toivo
You seem to know about this concept. What does this variable do and how come changing its value makes the site work?
It is a long story. I had a problem in a setup where several domains are pointing to the IP address of the server but only one domain is installed as a virtual host and therefore the other domains are assigned to the default virtual host.

A couple of times I noticed a different domain in the status bar while the home page was loading and managed to pinpoint the problem to a particular extension that had been installed recently. The code in that extension prompted me to look at the standard function JURI::base() (http://docs.joomla.org/JURI/base) in libraries/joomla/environment/uri.php. It sets a static variable to store the domain which it subsequently dishes out.

If the server has received an HTTP request for a domain different from the virtual host, my guess was that the domain from the static variable is presented in a subsequent request instead of the real domain. However, if $live_site is set in configuration.php, its value overrides the domain stored in the static variable in JURI::base().

It is an unlikely explanation but it fixed my problem. The reason for your problem may be different but using $live_site fixed it as well.

Re: Interesting 404 problems after moving site

Posted: Sat Feb 13, 2010 1:09 am
by Gatsu000
Well it did and didn't fix our problem. We added the live site variable to our website and at that point instead of 404 errors we got just blank white pages on every other page.

We figured what the hell maybe we screwed up. We killed the installation and database to see if fresh would work. We installed a fresh copy and it is working just fine without the live site variable.

To recap:
So joomla can run perfectly without that live site variable
Fresh installations work perfectly
Migrated site shows 404 errors
adding the live site variable only produces blank pages instead


Anyone have some solutions?

Re: Interesting 404 problems after moving site

Posted: Sat Feb 13, 2010 3:09 am
by toivo
The error causing the blank page is recorded in the PHP error log, the location of which is in the php.ini file.

Re: Interesting 404 problems after moving site

Posted: Sat Feb 13, 2010 5:12 am
by raghavtomar
@Gatsu000: Well...in that case, I think it is some sort of extension giving the problem. Try disabling all third party extensions on the migrated site. See if that cures the trouble. If it does, start enabling those extensions one by one. You will have the troublemaker in a net!

Re: Interesting 404 problems after moving site

Posted: Sat Feb 13, 2010 5:14 am
by raghavtomar
@Toivo: Thanks a lot!

Re: Interesting 404 problems after moving site

Posted: Sat Feb 13, 2010 3:06 pm
by Gatsu000
What does this mean?

[Sat Feb 13 08:03:49 2010] [error] [client (blanked)] PHP Fatal error: Cannot redeclare JConfig::$live_site in /path/to/site/public_html/configuration.php on line 21

Re: Interesting 404 problems after moving site

Posted: Sat Feb 13, 2010 7:58 pm
by toivo
You may have two lines starting with $live_site in the file configuration.php.

Re: Interesting 404 problems after moving site

Posted: Sat Feb 13, 2010 9:25 pm
by Gatsu000
I see that got rid of the blank pages. Every time we load a page and get those mysterious 404 errors we get this log

[Sat Feb 13 14:09:49 2010] [error] [client 65.36.241.76] PHP Notice: Trying to get property of non-object in /pathtofiles/public_html/includes/router.php on line 179
[Sat Feb 13 14:09:49 2010] [error] [client 65.36.241.76] PHP Notice: Trying to get property of non-object in /pathtofiles/public_html/includes/router.php on line 182

What is this router thing? Someone might be able to let me know what that is (the live site is properly in place now btw)

Re: Interesting 404 problems after moving site

Posted: Sun Feb 14, 2010 10:32 am
by Gatsu000
Ok, we found our problem. While doing some digging we looked at the lines of code in our routing table

Code: Select all

			//Set the information in the request
			$vars = $item->query;

			//Get the itemid
			$vars['Itemid'] = $item->id;
SO we read the pages http://docs.joomla.org/Routing

After thinking for awhile. What would try to read the incorrect file hierarchy? We had changed everything in all the correct places. Well we realized we had caching set. We simply cleared the entire cache and it worked just fine. We were even able to remove the live site variable and it still worked.