我怎样才能只为友好的URL重写htaccess?我有
RewriteRule ^products/([0-9]+)?$ show_a_product.php?product_id=$1 [NC,L]
我想重定向只为像URL /products/1
,但它也工作/show_a_product.php?product_id=1
您可以使用另一条规则来阻止/show_a_product.php?product_id=1
URI:
RewriteEngine On
RewriteCond %{THE_REQUEST} /show_a_product\.php[?/\s] [NC]
RewriteRule ^ - [L,R=404]
RewriteRule ^products/(\d+)/?$ show_a_product.php?product_id=$1 [QSA,NC,L]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句