I'd like to take any URL where segment_1 == "supernav"
and remove that segment. So this:
http://alpha.ced.berkeley.edu/supernav/gallery/
Would become this:
http://alpha.ced.berkeley.edu/gallery/
How can I do this?
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It only takes a minute to sign up.
Sign up to join this communityI'd like to take any URL where segment_1 == "supernav"
and remove that segment. So this:
http://alpha.ced.berkeley.edu/supernav/gallery/
Would become this:
http://alpha.ced.berkeley.edu/gallery/
How can I do this?
I'd create a template group called supernav, and put this in its index template:
{redirect="{segment_2}/{segment_3}"}
(If there's no 3rd segment present, EE will ignore it.)
If you're not actually talking about doing a redirect (it's not quite clear from your question for me) then you may want to consider using Freebie for this:
http://devot-ee.com/add-ons/freebie
In the freebie extension settings you can set supernav to be ignored so, any time you hit http://alpha.ced.berkeley.edu/gallery/
you are really hitting http://alpha.ced.berkeley.edu/supernav/gallery/
And of course you would make sure in your hrefs that you removed supernav/
.
Here are a couple mod_rewrite options to try in your .htaccess file to remove the "supernav" segment of your URL:
RewriteEngine On
RewriteBase /
RewriteRule ^supernav/gallery/$ /gallery [L]
or
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ supernav/$1 [L]
Worth taking a look at...