CodeIgniter Forums
htaccess, redirect from folder/index.php to folder/ ... how? - 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: htaccess, redirect from folder/index.php to folder/ ... how? (/showthread.php?tid=55980)



htaccess, redirect from folder/index.php to folder/ ... how? - El Forum - 11-19-2012

[eluser]slapyo[/eluser]
I want to redirect to the root if someone accesses /controller/index.php ... if for whatever reason someone would put index.php on the end of the url. I just want it to go back to the root.

http://www.somesite.com/controller/index.php -> http://www.somesite.com

.htaccess:
Code:
RewriteEngine on

RewriteCond %{THE_REQUEST} /index\.php
RewriteRule ^(.*)$ / [R=301,L]

RewriteCond $1 !^(crossdomain\.xml|index\.php|robots\.txt|css/|images/|scripts/)
RewriteRule ^(.*)$ /index.php/$1 [L]

I get the error "No input file specified."

Ideas?


htaccess, redirect from folder/index.php to folder/ ... how? - El Forum - 11-20-2012

[eluser]noslen1[/eluser]
Have you set a default controller in your /config/routes.php ?


htaccess, redirect from folder/index.php to folder/ ... how? - El Forum - 11-20-2012

[eluser]slapyo[/eluser]
I have. The site is running no problem. URLs are like http://www.somesite.com/controller/ ... Just looking to remove index.php off the tail if someone puts it on.