views:

48

answers:

3

Hello,

Can anyone help to solve problem with overriding in apache2 ?

I have enabled mod_rewrite in apache2.

ut apache just ignores my .htaccess file with rewrite rules. When I add this line to my .htaccess file:

This is my virtual host configuration:

<VirtualHost *:80>
ServerName www.modomain.eu
ServerAlias mydomain.eu *.mydomain.eu mydomain.es *.mydomain.es
DocumentRoot /home/sites/mydomain.es
<Directory /home/sites/mydomain.es>
allowoverride none
</Directory>
</VirtualHost> 
+1  A: 

Read here e.g.:

By default, mod_rewrite configuration settings from the main server context are not inherited by virtual hosts. To make the main server settings apply to virtual hosts, you must place the following directives in each section:
RewriteEngine On
RewriteOptions Inherit
ShinTakezou
You don't need `RewriteEngine On` in the main config. This can be done directly in .htaccess.In the above example, the `AllowOverride` is set to `none`. Unless this is turned on, you will be unable to process the .htaccess file.
shreddd
+2  A: 

.htaccess files aren't processed if you have AllowOverride set to "none". If you set it to "allowoverride all" it should allow you to override the settings in your vhost configuration file.

jwpage
A: 

Set the following:

AllowOverride All

In the <Directory> stanza

This will allow the .htaccess file to be able to override various settings (such as rewrite rules)

shreddd