简体   繁体   中英

Apache mod_rewrite rules not being processed from .htaccess files

Can anyone help to solve problem with overriding in apache2?

I have enabled mod_rewrite in apache2.

But apache is just ignoring my .htaccess file's rewrite rules.

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> 

.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.

Read here eg:

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM