Simply remove a url segment with .htaccess

前端 未结 2 498
逝去的感伤
逝去的感伤 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 10:42

    Although this has already been answered, it didn't work for me when I had two segments after the first, eg:

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

    Instead this worked for me and also takes care of 301 redirects:

    RedirectMatch 301 /entry/(.*) /$1
    

    Hope this helps.

提交回复
热议问题