CodeIgniter Forums
Problem with .htaccess and slash in URI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Problem with .htaccess and slash in URI (/showthread.php?tid=65590)



Problem with .htaccess and slash in URI - mixinix - 06-28-2016

URI will be redirected to http://ci4.dev/public/<controller>/<...> when I'm accessing controller with add slash at the end.

Like this:

Code:
   http://ci4.dev/home/

    
will be redirected to:

Code:
   http://ci4.dev/public/home => Not Found!

Normal:

Code:
   http://ci4.dev/home

    
The .htaccess file:

Code:
   # Redirect Trailing Slashes...
   RewriteRule ^(.*)/$ /public/$1 [L,R=301]


Problem solved with this change (removed '/public'):

Code:
  # Redirect Trailing Slashes...
   RewriteRule ^(.*)/$ /$1 [L,R=301]


    
Apache: 2.4.18
ENVIRONMENT: development