Forum Moderators: coopster

Message Too Old, No Replies

codeigniter trailing slash

         

narkis

12:30 pm on Jun 8, 2010 (gmt 0)

10+ Year Member



Hello,

I use codeigniter framework, and i have a problem in the route array with the friendly URL,
it does not get trailing slash in the key..

for example:
$route['page/']='page.php';

when you add page/ to the URL it is supposed to go to page.php but the route array does not get it because of the trailing slash.

is there solution for it?

L33t_J0rdan

6:27 am on Jun 16, 2010 (gmt 0)

10+ Year Member



Leave it out...

Readie

12:05 pm on Jun 16, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



a .htaccess rewrite to remove the trailing slash:

RewriteCond %{REQUEST_URI} ^.*?/$
RewriteRule ^(/?[^/]+(/[^/]+)*)/$ http://example.com/$1 [R=301,L]

Should do the trick - then simply don't look for the trailing slash.