0

I've setup a template group called 'landing' and i want to allow users to visit a clean url like the following:

http://domain.com/url_title

At the moment it works if I include the template group (http://domain.com/landing/url_title) so how can I remove the template group from the url?

Through a .htaccess file?

Appreciate any guidance.

N

1 Answer 1

1

If you know the specific URLs you want to be redirected, and want to redirect only those, you'd add this (before the standard EE Rewrites):

RewriteRule ^url_title$ /index.php/landing/url_title [L]

e.g., for multiple:

RewriteRule ^url_title1$ /index.php/landing/url_title1 [L]
RewriteRule ^url_title2$ /index.php/landing/url_title2 [L]

And, finally, if there's a pattern, you could match on the pattern, like this:

RewriteRule ^url_title(.*)$ /index.php/landing/url_title$1 [L]

UPDATED: removed a really bad idea I suggested in my first version!

2
  • Hi Jay, that makes sense but it's not the intended result. If i now visit domain.com/url_title I don't reach an entry. Sep 12, 2013 at 21:41
  • to test, change this to a 302 redirect (which will change the URL in the browser bar)--e.g.,: RewriteRule ^url_title$ /index.php/landing/url_title [R=320,L] Does it show you the right page? Does it have the right entry?
    – Jay F
    Sep 12, 2013 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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