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