2

Is there a way, WITHOUT PHP, to test if a segment begins with a value?
We send emails with shortened URLs and want to be able to parse the segments accordingly.

i.e.

http://www.oursite.com/20140709XXXYY

would need to redirect to

http://www.oursite.com/event/20140709XXXYY

Or, is there a way to do this in .htaccess?

Yes, they will always be the similar to the one above, plus, we may also have some like this:

http://www.oursite.com/agenda/20140709XXXYY

which would need to redirect to

http://www.oursite.com/Chuy/DownloadFile2.aspx?File=Q:\\AGENDAS\\20140709XXXYY.pdf
1

It sounds like you are looking for a way to manage redirects using ExpressionEngine. You could do it with htaccess, yes, but it's really convenient to do it with EE.

Take a look at Detour Pro.

Since you have some redirects that are repetitive in nature, it's possible you could make use of Detour Pro's "Wildcard Redirect" or "Wildcard Redirect with Segment Replacement" feature.

If that's not quite right, or if you want an alternate see Anna's suggestion of Router.

Router will automatically include the correct template for you, based on which of your regex patterns match the current URL.

4
  • see modifications – MB34 Dec 16 '13 at 20:11
  • I think you're best off using Detour Pro. – Alex Kendrick Dec 16 '13 at 20:13
  • We have 1000+ events per year and I don't want to have to manually setup the redirects, only redirect if the segment begins with '20'. Plus, there may also be a querystring with an email address that we use to log the person in at the same time. – MB34 Dec 16 '13 at 20:17
  • Since you have some redirects that are repetitive in nature, it's possible you could make use of Detour Pro's "Wildcard Redirect" or "Wildcard Redirect with Segment Replacement" feature. If that's not quite right, or if you want an alternatie see @Anna's suggestion of Router. "Router will automatically include the correct template for you, based on which of your regex patterns match the current URL." – Alex Kendrick Dec 16 '13 at 20:29
1

Two additional "routing" addons:

Template Routes
http://devot-ee.com/add-ons/template-routes

Router
http://devot-ee.com/add-ons/router

2
  • Those won't work for our cases. – MB34 Dec 16 '13 at 20:13
  • 1
    I think Router would work for you. What specifically makes that one seem not workable? – Alex Kendrick Dec 16 '13 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.