Welcome Guest, Not a member yet? Register   Sign In
virtualhost question

I have 4 domains that point to different pages on one domain.

They all work.

My only minor issue is that for the virtualhost document roots, I have, for simplified example:


When I restart apache, I get warned that no such documentroot exists.

Like I said it still works but it's annoying me. Anybody know a better way?


[eluser]Ahmed Nuaman[/eluser]
Use .htaccess rather than writing this in the *.conf file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^my\.domain\.com
RewriteRule ^(.*) /mypage.ext/something/

I might not be completely understanding you, or else I didn't state my question clearly enough.

I already use .htaccess in a way that I think you are describing, which prevents index.php from showing in the URL.

My main domain already has URLs like:


So in this case, index.php is not in the URL.

But I have 4 other domains that should point (via virtualhost directive I assume) to pages within that main site, for example, someone goes to


it should take them to


It all works already, and the URLs look fine. The only minor annoyance I'd like to fix is that every time I start Apache, I get warnings because the way I accomplish the above is by setting the document root in the virtualhost like (for someotherdomain.com)

DocumentRoot /home/myuser/www/mydomain/index.php/someothercontroller/somemethod

Does that make more sense or was there something I misunderstood about your reply?


[eluser]Ahmed Nuaman[/eluser]
Ok, the only reason it gives that error is because the DocumentRoot doesn't actually exist, it's variables being sent to index.php.

If you'd like to fix it, use .htaccess instead to not only hide the index.php file, but to also route the domains to those controllers.

I don't use .htaccess for my routing, instead I do the routing through CI itself.

Theme © iAndrew 2016 - Forum software by © MyBB