Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simply remove a url segment with .htaccess

I am simply trying to get this URL:

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

to redirect to:

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

The "random-entry-123" is dynamic.
Different for each entry. Any help with this is greatly appreciated!

like image 837
Danny Garcia Avatar asked Jan 28 '11 01:01

Danny Garcia


1 Answers

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.

like image 166
Orbling Avatar answered Sep 28 '22 19:09

Orbling