繁体   English   中英

mamp pro htaccess rewriteRule无法正常工作

[英]mamp pro htaccess rewriteRule not working

我已经搜索了很长时间,我无法弄清楚为什么重写规则不起作用。 我想翻译这个网址

HTTP://localhost/uniwood/template-allgemein.html postname = KONTAKT&的pageid = 27

HTTP://localhost/postname/kontakt.html

这里是htaccess文件中的代码

RewriteEngine On
RewriteRule ^postname/([^/]*)\.html$ /uniwood/template-allgemein.html?postname=$1&pageid=27 [L]

我在我的机器上本地使用mamp pro webserver并检查AllowOverride是否为“all”。

我没有犯任何错误! 也没有错误日志!

谢谢!

您可以在DOCUMENT_ROOT/.htaccess文件中使用此代码:

RewriteEngine On

RewriteCond %{THE_REQUEST} /template-allgemein\.html\?postname=([^\s&]+)&pageid=27 [NC]
RewriteRule ^ /postname/%1.html? [R=302,L,NE]

RewriteRule ^postname/[^.]+)\.html$ /template-allgemein.html?postname=$1&pageid=27 [L,NC,QSA]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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