VirtualHost Problem! 2 domains pointing to same directory!

Hi Guys ….

I have 2 domains and I setup a 2 Virual Host entries in my http.conf file.

NameVirtualHost 64.62.190.109:80

 <virtualhost 64.62.190.109:80="">ServerName www.reelanglers.net
    ServerAlias reelanglers.net
    DocumentRoot "/var/www/html"
    DirectoryIndex index.html</virtualhost> 

 <virtualhost 64.62.190.109:80="">ServerName www.rodvictoria.net
    ServerAlias rodvictoria.net
    DocumentRoot "/var/www/html/blog/wordpress"
    DirectoryIndex index.php</virtualhost> 

It's frustrating because it looks like I have everything configured right, but when I try to go to my new domain it points to my fishing site.

I have restarted httpd after making these changes.

The other strange thing is that it redirects to the reelanglers site when trying to go to the rodvictoria site.

Strange!

5 Replies

if you only have one ip address you dont need to bind your virtualhost's to a specific ip address.

aside from that your config matches might fairly close and I post 3 sites of the same node/ip address.

 <virtualhost *="">ServerName killboard.eve-razor.com
        ServerAlias killboard.eve-razor.com
        DocumentRoot /var/www/killboard</virtualhost> 

 <virtualhost *="">ServerName membertracker.eve-razor.com
        ServerAlias membertracker.eve-razor.com
        DocumentRoot /var/www/membertrack</virtualhost> 

make sure you DNS is pointing to the server for both domains ofc.

I tried going to rodvictoria.net, and when it started to load i was redirected to reelanglers.net.

I don't think that's an Apache issue. I'd suggest checking the wordpress configuration at the rodvictoria.net site.

The documentroot of RodVictoria.net is a subdirectory of ReelAnglers.net – the .htaccess (or php code) of the latter could be withholding directory access.

-- I'd put them in separate directories regardless, as per MrRx7.

www.rodvictoria.net is responding with "301 Moved Permanently" and redirecting to reelanglers.net. The headers include your PHP version and some Wordpress stuff too, so it's your Wordpress configuration that's causing the problem.

This can happen if something is amiss in your .htaccess file, or else you'll need to find out which URL your Wordpress installation thinks it's on. Wordpress has the nasty habit of remembering the URL where it was first installed. It behaves strangely when you move the files afterwards.

Use something like phpMyAdmin to open the Wordpress database.

Open the "wp_options" table.

Find "siteurl" (option id: 1) and "home" (option id: 39 on second page).

Both of them should be http://www.rodvictoria.net/ or whatever else you want your blog's address to be.

And as mjrich said, you probably want to put the two domains in separate directories even if Apache doesn't complain about it. Right now, one of your sites is accessible also as a subdirectory of another site. This will probably hurt your search engine ranking.

Awesome!

I moved the directory and also edited the database and it is now working properly!

Thanks So Much!!!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct