Neal Posted September 8, 2011 Report Share Posted September 8, 2011 Hi - I've migrated a number of Joomla sites from IIS6 to Apache and now am trying to test them using a subdomain - e.g. http://newsite1.mydomain.com, http://newsite2.mydomain.com I've updated .htaccess, configuration.php and httpd.conf - I believe correctly. The problem is, when I try to browse to the new sites, it comes back with:"Sorry, the website www.newsite1.mydomain.com cannot be found" So, it's adding a "www." to the beginning. Note that http://newsite1.mydomain.com/test.html works fine, as does http://newsite1.mydomain.com/administrator. What am I missing? Thanks,Neal Quote Link to comment Share on other sites More sharing options...
BobS Posted September 8, 2011 Report Share Posted September 8, 2011 Well, it's your browser that's adding the www. to the URL. The reason it does it is that it can't find the names in DNS. Specifically, it needs to find either *.mydomain.com or newsite1.mydomain.com. The alternative to updating the DNS server is to update your Hosts file with the names and point them to 127.0.0.1. Regards,BobS Quote Link to comment Share on other sites More sharing options...
Neal Posted September 8, 2011 Author Report Share Posted September 8, 2011 Well, it's your browser that's adding the www. to the URL. The reason it does it is that it can't find the names in DNS. Specifically, it needs to find either *.mydomain.com or newsite1.mydomain.com. The alternative to updating the DNS server is to update your Hosts file with the names and point them to 127.0.0.1. Regards,BobS Bob - Thanks for the reply. I'm not sure why it can't find the names in DNS. I believe I have setup the sub-domains properly in DNS and pointed them to the server's IP. And, as I mentioned, http://newsite1.mydomain.com/test.html is working fine, just not the default http://newsite1.mydomain.com/index.php. So, other than pointing the A record to the server's IP, what other change would I need to make in DNS? Thanks,Neal Quote Link to comment Share on other sites More sharing options...
Neal Posted September 13, 2011 Author Report Share Posted September 13, 2011 Well, I tried updating my HOSTS file and that didn't change anything. Again, http://newsite1.mydomain.com/test.html and http://newsite1.mydomain.com/administrator both work, but http://newsite1.mydomain.com/ and http://newsite1.mydomain.com/index.php both report an error from the browser: Server not foundFirefox can't find the server at www.newsite1.mydomain.com Does anyone else have any suggestions? Quote Link to comment Share on other sites More sharing options...
BobS Posted September 14, 2011 Report Share Posted September 14, 2011 Sorry, Neal, I must have been sleeping to miss your comment. What's significant is that you get a response from some of your URLs. That means that DNS at least has a mapping from newsite1.mydomain.com to the IP of your server. So we can rule out DNS as (part of) the problem. Also, put your HOSTS file back to the way it was. So the problem must be in the vhosts config. But I just double-checked my setup and I get the same results as you do! We'll have to do more analysis on this problem.... Regards,BobS Quote Link to comment Share on other sites More sharing options...
Neal Posted September 14, 2011 Author Report Share Posted September 14, 2011 So the problem must be in the vhosts config. But I just double-checked my setup and I get the same results as you do! We'll have to do more analysis on this problem.... Bob -Well, I'm glad you were able to reproduce this.But, I don't think the problem is in the Vhosts config, since I'm able to create a new Joomla site and it works fine, with the same vhost setup as the others. The only difference is that the new Joomla site is 1.7 and the ones I've copied over from IIS6 are 1.5.22.It seems that somewhere in the Joomla front-end code (not back-end, since that works fine), it's re-directing the URL.Look forward to seeing what you find out...Thanks,Neal Quote Link to comment Share on other sites More sharing options...
BobS Posted September 14, 2011 Report Share Posted September 14, 2011 Okay, Round 2! Let's go back to the beginning. We'll start with adding a vhost for newsite.mydomain.lan to a clean UniServer instance. In \usr\local\apache2\conf\httpd.conf, near the end is the vhosts section.We'll add the following lines: <VirtualHost *:80> ServerAdmin webmaster@localhost.org DocumentRoot C:/UniServer/vhosts/newsite1 ServerName newsite1.mydomain.lan ServerAlias www.mydomain.lan *.mydomain.lan ErrorLog logs/newsite1.mydomain.lan-error.log CustomLog logs/newsite1.mydomain.lan-access.log common </VirtualHost> Next, we need to put a simple index.html file into the document root: C:/UniServer/vhosts/newsite1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>VHOST TEST</title> </head> <body> <h2>This is NEWSITE1</h2> </body> </html> Finally, since we're not using the IP for mydomain.lan (if it existed), I'll set up a "shorcircuit" in the hosts file:127.0.0.1 newsite1.mydomain.lanWe'll can test this by opening a command prompt to ping newsite1.mydomain.lan . Now we can (re)start Apache and point our browser to newsite.mydomain.lan. This will connect us to the page we just created above. Since I copied this code directly from my working site, I know it functions properly. The key points of this exercise are to validate that the vhosts system works as expected, and to create a functional template that can be edited to create the desired site hosts. Regards,BobS Quote Link to comment Share on other sites More sharing options...
BobS Posted September 14, 2011 Report Share Posted September 14, 2011 AHA!! You didn't mention that you were using older Joomla! code.There might be a problem with the version of PHP. You should check with the Joomla! site for compatibility requirements. I don't really know if this is the problem, but in the past when I've attempted to port old code, I have run into PHP version-related errors. Again, though, in all cases you should start with a simple test. See if you can just get a basic html page to respond properly for the new vhost, and then slap in the Joomla code. Regards,BobS Quote Link to comment Share on other sites More sharing options...
Neal Posted September 14, 2011 Author Report Share Posted September 14, 2011 There might be a problem with the version of PHP. You should check with the Joomla! site for compatibility requirements. Again, though, in all cases you should start with a simple test. See if you can just get a basic html page to respond properly for the new vhost, and then slap in the Joomla code. To confirm Joomla would run ok, I downloaded and installed Joomla 1.5.23 using a new subdomain (test.mydomain.com), added a new Vhost and it works fine with the new version of PHP. I then upgraded one of my test sites to 1.5.23 (just to make sure there wasn't an issue fixed between 1.5.22 and 1.5.23) but I still have the problem with the front-end. When I go to http://newsite1.mydomain.com/, I get the same error:Firefox can't find the server at www.newsite1.mydomain.com but Administrator works fine. To review, the things I did:1. Copy a Joomla 1.5.22 site to a new server2. On new server, used Uniform Server (Apache) instead of IIS63. Created a new sub-domain to access the site (since my current site is still Live on the IIS server)4. Setup/updated configuration.php, httpd.conf and .htaccess Any other ideas would be appreciated. Quote Link to comment Share on other sites More sharing options...
Neal Posted September 17, 2011 Author Report Share Posted September 17, 2011 To review, the things I did:1. Copy a Joomla 1.5.22 site to a new server2. On new server, used Uniform Server (Apache) instead of IIS63. Created a new sub-domain to access the site (since my current site is still Live on the IIS server)4. Setup/updated configuration.php, httpd.conf and .htaccess Any other ideas would be appreciated. Ok, here's a clue that should crack this (I hope). I went into the main Index.php file and after doing a series of traces, found that if I change the last line in the file from this: echo JResponse::toString($mainframe->getCfg('gzip')); to this: echo JResponse::toString($mainframe->getCfg('')); the site renders fine and doesn't redirect to add the "www.". So, what's going on? Thanks,Neal Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.