[英]Mod_Rewrite not rewriting URLs
我有以下網址結構:
.htaccess文件具有以下代碼:
RewriteEngine On
RewriteRule ^([^/]*)\.html$ /page.php?file=$1 [L]
完全不要嘗試重寫URL。 我正在尋找/about.html、/contact.html之類的東西
是.htaccess代碼還是服務器上的某種設置?
您可以使用:
RewriteEngine On
RewriteCond %{THE_REQUEST} /page\.php\?file=([^\s&]+) [NC]
RewriteRule ^ /%1.html? [R=302,L,NE]
RewriteRule ^([^/]+)\.html$ page.php?file=$1 [L,QSA,NC]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.