0

I'm a FED but I've never even heard of Expression Engine. I googled and poked around with no luck.

Unfortunately we've only been given access to their CMS (EE) and we're getting a request to create some 301 redirects. Any help is appreciated! Thank you!

1
3

Yes!

Use the redirect variable in your template.

From the documentation:

{redirect='news/local' status_code="301"}

3
  • Would you mind elaborating on how that is done? For example, I how would I do this with the code above? (Normally I would throw this in the htaccess) Redirect 301 /mypage1.html http://www.xyz.com/newpage1.html Redirect 301 /mypage2.html http://www.xyz.com/newpage2.html – nthChild Jun 29 '17 at 13:52
  • As AllInOne stated above, simply add the redirect tag to the template page where you need to redirect it. So if your template is /blog/page and you need to redirect to blog/another_page you'd place the tag in the blog/page template with {redirect='blog/another_page' status_code='301'}. Place the redirect tag on as many page templates as needed. It does not matter where in the page template you have the tag as EE will pick it up when the page is accessed, but it may be good practice to place the tag at the top of the template so that it is the first tag read. – pixldev Jun 30 '17 at 6:54
  • It is likely that the same template is serving multiple "pages" that will require different redirects. In this case utilise a set of conditionals looking at the url segments. EE url segments can be referenced as {segment_1}, {segment_2} etc. Such as {if segment_2=="somepage}{redirect="/some/otherpage" status_code="301"}{/if} – foamcow Jul 6 '17 at 22:32

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.