my htaccess code
RewriteCond %{THE_REQUEST} 's/detail'.php'?id=([_0-9a-zA-Z-]+)'s [NC]
RewriteRule ^temp/detail/%1? [R=301,L]
RewriteRule ^temp/detail/([_0-9a-zA-Z-]+)$ /detail.php?id=$1 [L]
让我的网址点赞
temp.example.com/detail/xxxxxx
从
temp.example.com/detail.php?id=xxxxxx
现在我想在末尾附加.html,以便 url 变成这样:
temp.example.com/detail/xxxxxx.html
我需要和 htaccass 规则,这将使我的网址像上面一样,但不应该表现得像 html。
谢谢
使用此根.htaccess
:
RewriteCond %{THE_REQUEST} 's/detail'.php'?id=([_0-9a-zA-Z-]+)'s [NC]
RewriteRule ^ detail/%1.html? [R=301,L]
RewriteRule ^detail/([_0-9a-zA-Z-]+?)(?:'.html)?$ detail.php?id=$1 [NC,L]