CodeIgniter Forums
How to automatically add trailing slash in address bar? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to automatically add trailing slash in address bar? (/showthread.php?tid=43896)



How to automatically add trailing slash in address bar? - El Forum - 07-27-2011

[eluser]vadimyer[/eluser]
Hello!

The situation is:
1) User enters some URL in the address bar, like:
http://codeigniter.com/hello

2) I need CI to automatically redirect to this URL but with trailing slash in the end. I need this to let search engines know that this is the only one original page and to not allow duplicate content (the page w/o trailing slash).

3) At the same time I need some pages to be like http://codeigniter.com/hello/page.html
It's the case in which I don't need trailing slash to be automatically added.

I guess I need some kind of redirection for all of this, but can you please show me an example?

Thanks in advance!


How to automatically add trailing slash in address bar? - El Forum - 07-27-2011

[eluser]joakley77[/eluser]
Would using 403 redirects be a viable solution for you?