Good morning everybody,
I am using Virtualmin to manage our portals and I have a problem on the usage of RewriteCond in the apache configuration of a custom template.
Starting from the default directives of apache (below): ServerName ${DOM} ServerAlias www.${DOM} DocumentRoot ${HOME}/public_html ErrorLog /var/log/virtualmin/${DOM}_error_log CustomLog /var/log/virtualmin/${DOM}_access_log combined ScriptAlias /cgi-bin/ ${HOME}/cgi-bin/ DirectoryIndex index.html index.htm index.php index.php4 index.php5 Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch allow from all AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch allow from all AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
The following configuration has been added in order to rewrite the domain.com to www.domain.com RewriteEngine on RewriteCond %{HTTP_HOST} =${DOM} [NC] RewriteRule ^(.*) http://www.${DOM}$1 [R=301,NE]
But this configuration it seems not working on the domain.
Do you have any suggestion? Thanks for help!
Simone
Howdy,
When you say that the configuration isn't working -- what problem are you experiencing exactly? Are you receiving an error?
If so, what messages do you see in $HOME/logs/error_log?
-Eric
Dear Eric,
thanks for your support.
No error appear in the the log and the rule is simply ignored by the system.
I mean the domain.com should be redirected to www.domain.com but this thing does not happen...
Thanks, Simone
Howdy,
Well, if the above configuration is part of your Server Templates -- that would only apply to newly created domains.
Can you take a look at your Apache VirtualHost configuration that's not working properly, and verify that you see the rewrite information in it?
If so, can you paste what the full VirtualHost block looks like into here?
-Eric