Welcome Guest, Not a member yet? Register   Sign In
.htaccess Ignore Existing Folders
#1

[eluser]BradEstey[/eluser]
My .htaccess file is pretty simple.

Code:
RewriteEngine On
RewriteBase /
RewriteCond $1 !^(index\.php|robots\.txt|img/|css/|js/)
RewriteRule ^(.*)$ index.php?/$1 [L]

Basically it just sends everyone to the index.php file, except calls inside the img/, css/, or js/ directories or the robot.txt. This works out pretty well because I can still have a page called site.com/img if I want (though I obviously wouldn't.. but by putting in the / after the directory name it keeps it from ignoring pages like site.com/imgggg or whatever else may start with the letters 'img'.)

My problem is, lets say i create a folder called 'products' in my public directory and also have a page called site.com/products. for some reason site.com/products/ works fine and loads the controller, but without the trailing slash it forces you to go to site.com/products/?/products

This isn't a debilitating issue or anything, but I just thought it was strange. Is something in my .htaccess triggering this or is it something in the CodeIgniter core?
#2

[eluser]frist44[/eluser]
add this to htaccess

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

it'll only redirect if it doesn't find the request as a file or directory on your server




Theme © iAndrew 2016 - Forum software by © MyBB