CodeIgniter Forums
htaccess and accessing folders - 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 and accessing folders (/showthread.php?tid=21616)



htaccess and accessing folders - El Forum - 08-15-2009

[eluser]HooJee[/eluser]
Hi Guys

I have enabled mod rewrite and added the following code to my htaccess file:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

The problem is I have a public folder in the root dir which has all the CSS,images etc - I cannot access it. Does anyone know how I can fix this ?


htaccess and accessing folders - El Forum - 08-15-2009

[eluser]Dam1an[/eluser]
You need to either add the name of the directory to the rewrite condition, so it becomes
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|public)
RewriteRule ^(.*)$ /index.php/$1 [L]
or change it so anything which doesn;t match a file goes through index.php
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]