简体   繁体   English

Apache .htaccess URL 重写在 URL 路径中添加附加目录

[英]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.

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