Simply remove a url segment with .htaccess

前端 未结 2 501
逝去的感伤
逝去的感伤 2020-12-19 10:09

I am simply trying to get this URL:

http://foo.com/entry/random-entry-123

to redirect to:

http://foo.com/random-entry-123
<         


        
2条回答
  •  心在旅途
    2020-12-19 11:03

    Assuming no further rewrites are in use, and all links inside /entry/ are to rewritten, then try this:

    RewriteEngine on
    RewriteBase /
    
    RewriteRule ^/entry/(.+)$ /$1 [L,QSA]
    

    Lose the [L] if there are further rewrites ahead in the file.

提交回复
热议问题