Htacess Rewrite Rule - Doesn't work without Trailing Slash

后端 未结 2 365
孤街浪徒
孤街浪徒 2021-01-25 16:59

So I have the following Rewrite Rules:

RewriteRule ^([a-z0-9_\\-]+)(\\.php)?$ index.php?page=$1 [NC,L,QSA]
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?shop=$1&         


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-25 17:13

    In your second rule, add ? after trailing slash:

    RewriteRule ^([a-zA-Z0-9_-]+)/?$ index.php?shop=$1&page=index [NC,L,QSA]
    

    That will make trailing / optional

提交回复
热议问题