Welcome to WebmasterWorld Guest from 35.172.100.232

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Hosting two sites using named virtual hosting

Working....but not quite right

     
6:06 am on Apr 17, 2012 (gmt 0)

New User

5+ Year Member

joined:Apr 17, 2012
posts: 5
votes: 0


Hi to all,

Firstly thank you for the wonderful forum, some great info on here that has already helped me tremendously.

As a complete novice, I have managed to co-host two e-commerce sites on my apache webserver. I am using named v-hosts to achieve this. I have one major obstacle still to over come.

I have two domains, lets call them the following;

happydomain.com
and
nothappydomain.com

Both sites are being correctly served by apache, hence when browsing to www.happydomain.com, the appropriate site and pages are retrieved, likewise for www.nothappydomain.com

The problem is ;

When browsing to www.nothappydomain.com, after getting the header reply, the URL in the browser address bar changes to www.happydomain.com/contentfolder/
The correct page is shown and all the links work, but I DO NOT WANT it to show happydomain in the address bar, I want it to show nothappydomain in the address bar.

Countless research and configuration changes have got me nowhere, I need some expert assistance here. I'm guessing maybe due to the folder structure it is doing some sort of redirect, but I'm not sure how to fix this or mask it.

Thank you in advance. Any associated config code you need just ask and I will post to make things easier.
2:22 pm on Apr 17, 2012 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 25, 2004
posts:161
votes: 0


Hi! I'm in the middle of this RIGHT NOW!


#redirect other sites to subfolder
RewriteCond %{HTTP_HOST} ^(www.)?nothappy.com$
RewriteCond %{REQUEST_URI} !^/contentfolder
RewriteRule ^(/)?$ contentfolder/$1 [L]
3:23 pm on Apr 17, 2012 (gmt 0)

Moderator from GB 

WebmasterWorld Administrator mack is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:June 15, 2001
posts:7844
votes: 93


Can you post the virtual host entries you placed into your Apache config file?

Mack.
11:15 pm on Apr 17, 2012 (gmt 0)

New User

5+ Year Member

joined:Apr 17, 2012
posts: 5
votes: 0


Thanks guys, v-host config is below ;

NameVirtualHost *:80


<VirtualHost *:80>
ServerAdmin gxxh@nothappydomain.com.au
DocumentRoot "C:/xampp/htdocs/magento/"
ServerName nothappydomain.com
ServerAlias www.nothappydomain.com
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin grxxh@happydomain.com
DocumentRoot "C:/xampp/htdocs/"
ServerName happydomain.com
ServerAlias www.happydomain.com
ErrorLog "logs/dummy-host2.localhost-error.log"
CustomLog "logs/dummy-host2.localhost-access.log" common
</VirtualHost>
5:01 am on Apr 18, 2012 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11817
votes: 236


welcome to WebmasterWorld, ApacheNewKid!

do you have any mod_alias and/or mod_rewrite directives in your server config and/or C:/xampp/htdocs/magento/.htaccess file?

what status code do you get when you request http://www.nothappydomain.com/ and do you also get a redirect when you request a subdirectory or a document in the root directory?

after getting the header reply

could you be more specific?
5:32 am on Apr 18, 2012 (gmt 0)

New User

5+ Year Member

joined:Apr 17, 2012
posts: 5
votes: 0


OK, this is going to be painful and you WILL shake your head on more than one occasion due to my lack of knowledge.

With that said;

1) have no custom mod_alias or mod_rewrite directives in either the httpd or .htaccess files

2) captured from live headers, I get the following response from apache to my browser request

HTTP/1.1 302 Found
Date: Wed, 18 Apr 2012 05:26:17 GMT
Server: Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.5
Location: [electronicmarket.com.au...]
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8

The location listed in the above capture is for the "other" domain, and not the "actual" domain being browsed.

Cheers.
5:38 am on Apr 18, 2012 (gmt 0)

New User

5+ Year Member

joined:Apr 17, 2012
posts: 5
votes: 0


I should have added, the redirect remains for any and all document and sub-directory requests.
7:42 am on Apr 18, 2012 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11817
votes: 236


i assume you have a default directory index document specified.
(look for mod_dir directive DirectoryIndex)

i would assume at this point that the C:/xampp/htdocs/magento/index.php (or whatever it is) is providing the 302 status code response and Location: header.

i'm kind of curious what response you get for a http://www.happydomain.com/magento/ request.

[edited by: engine at 5:32 pm (utc) on Apr 18, 2012]
[edit reason] de-linked [/edit]

11:52 am on Apr 18, 2012 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 25, 2004
posts:161
votes: 0


yeah i'm still stuck on this, all my links beyond the home page of the domain are still showing the extra path info :-(
2:19 am on Apr 19, 2012 (gmt 0)

New User

5+ Year Member

joined:Apr 17, 2012
posts: 5
votes: 0


"i would assume at this point that the C:/xampp/htdocs/magento/index.php (or whatever it is) is providing the 302 status code response and Location: header. "

Yeah, I am now sure, the Apache config is all OK, I dropped a temporary test site into the same directory and the redirect does not occur. Hence it is definitely an issue with the code in the index.php.

I will investigate this further and report findings.

Thanks to all for their helps so far. Appreciated.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members