mod-rewrite recursive loop

后端 未结 6 1602
滥情空心
滥情空心 2021-02-11 08:49

I want to change my website\'s dynamic urls to Search Engine Friendly URL\'s

Now the urls like this www.website.com/news.php?id=127591 , I want it became this www.websit

6条回答
  •  南笙
    南笙 (楼主)
    2021-02-11 09:21

    You need to inspect the URI in the HTTP request line (i.e. %{THE_REQUEST}) as the other could already have been rewritten (like in your case):

    RewriteCond %{THE_REQUEST} ^GET\ /news\.php\?
    RewriteCond %{QUERY_STRING} ^id=([0-9]+) 
    RewriteRule ^news\.php /news/%1? [R=301,L]
    

提交回复
热议问题