Why isn't this site.conf working?
Hey LQ,
I'm trying to set up a rewrite rule in site.conf. I just very simply want to make it so when visiting mydomain.com it forwards to www.mydomain.com. Code:
<VirtualHost *:80> |
The rewrite rule is inside the www.mydomain.net VirtualHost definition, so it is never seen and never used.
Set up VirtualHost for mydomain.net instead: Code:
<VirtualHost *:80> |
So, just to be clear I want my .conf to look like this:
Code:
<VirtualHost *:80> |
No, actually more like this...
Code:
<VirtualHost *:80> You could put the ServerAlias alone inside the www.mydomain.net VirtualHost, without a redirect. But if you want clients to land on www and bookmark it, you should use the separate VirtualHost with redirect for that. |
Quote:
|
No, it will only redirect mydomain.net with no subdomains. Other subdomains will need their own VirtualHost blocks.
You might want to change the order of the VirtualHosts too, remember that the first VirtualHost will become the default for the server. Other than the first one being default order does not matter. |
Quote:
|
Code:
<VirtualHost *:80> Do I gotta make sure some modrewrite or something is enabled? |
Perhaps I need to create another .conf file in sites-available? one for just domain.conf? and put the server alias stuff in that script instead?
|
Quote:
I am not an Ubuntu user so can't help you much with what their defaults are. I use Slackware which pretty much uses the Apache defaults and all my vhosts are normally in a single file. But as long as they all get included you can split them up any way that you like. |
Quote:
|
Quote:
BTW you can also use the following for the domain.net vhost: Code:
<VirtualHost *:80> |
All times are GMT -5. The time now is 02:07 AM. |