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.


    DocumentRoot "/var/www/html"
    DirectoryIndex index.html</virtualhost> 

    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.


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
        DocumentRoot /var/www/killboard</virtualhost> 

 <virtualhost *="">ServerName
        DocumentRoot /var/www/membertrack</virtualhost> 

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

I tried going to, and when it started to load i was redirected to

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

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

-- I'd put them in separate directories regardless, as per MrRx7. is responding with "301 Moved Permanently" and redirecting to 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 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.


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

Thanks So Much!!!


Please enter an answer

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] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct