Apache mod_rewrite 规则未从 .htaccess 文件处理

发布于 2024-09-04 05:34:47 字数 443 浏览 2 评论 0原文

任何人都可以帮助解决 apache2 中的覆盖问题吗?

我已经在apache2中启用了mod_rewrite。

但 apache 只是忽略我的 .htaccess 文件的重写规则。

这是我的虚拟主机配置:

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

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> 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

橘虞初梦 2024-09-11 05:34:47

如果您将AllowOverride 设置为“none”,则不会处理.htaccess 文件。如果将其设置为“allowoverride all”,它应该允许您覆盖虚拟主机配置文件中的设置。

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

够运 2024-09-11 05:34:47

请阅读此处,例如:

默认情况下,虚拟主机不会继承主服务器上下文中的 mod_rewrite 配置设置。要使主服务器设置应用于虚拟主机,您必须在每个部分中放置以下指令:

RewriteEngine On
RewriteOptions Inherit

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
迷爱 2024-09-11 05:34:47

设置以下内容:

AllowOverride All

节中

这将允许 .htaccess 文件能够覆盖各种设置(例如重写规则)

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文