[英]Apache .htaccess URL rewrite adding additional directory in URL path
I'm trying to build a URL rewrite by adding an additional directory in the URL path;我正在尝试通过在 URL 路径中添加一个附加目录来构建 URL 重写; for example, changing;
例如,改变;
https://FQDN/mypage/ to https://FQDN/dev/mypage/ https://FQDN/mypage/到https://FQDN/dev/mypage/
https://FQDN/template/ to https://FQDN/dev/template/ https://FQDN/template/到https://FQDN/dev/template/
I have written the following .htaccess although this is having no affect.我写了以下 .htaccess 虽然这没有影响。 I have already enabled a2enmod rewrite.
我已经启用了 a2enmod 重写。
RewriteEngine on
RewriteRule ^dev/(.+)$ /$1
Thank you @anubhava - simple fix, the rewrite was not activating due to AllowOverride None
being active in the apache2.conf file.谢谢@anubhava - 简单的修复,由于
AllowOverride None
在 apache2.conf 文件中处于活动状态,因此重写未激活。 Changing this to AllowOverride All
allowed the .htaccess file to be active.将此更改为
AllowOverride All
允许 .htaccess 文件处于活动状态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.