Skip to content

.htaccess fix #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

lalunelight
Copy link

RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d

there is a syntax error here, the parentheses are wrong so it won't work.
after fixing it, you won't need this line:
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
or you can use it alone instead.

the difference between the two that:
in the first method

RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteRule ^(.*)$ ./index.php/$1 [L] 

the only folders (or files) that can be accessed without CodeIgniter are the ones in between the parentheses only,
any other request will route through CodeIgniter.

but in the second method:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]

if you put this instead, your request will went through CodeIgniter only if isn't a path to a real file/folder on your system.
for example: if you have a folder name "test" in your project
using the first one (without putting "test" inside the parentheses) will take you to "test" controller.
but if you use the second way, apache will open "test" folder.

RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
there is a syntax error here, the parentheses are wrong so it won't work.
after fixing it, you won't need this line:
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
or you can use it alone.

the difference between the two that:
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteRule ^(.*)$ ./index.php/$1 [L] 
the only folders (or files) that can be accessed without CodeIgniter are the ones in between the parentheses only,
any other request will route through CodeIgniter.

but in the second method:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]
if you put this instead, your request will went through CodeIgniter only if isn't a path to a real file/folder on your system.
for example: if you have a folder name "test" in your project
using the first one (without putting "test" inside the parentheses) will take you to "test" controller.
but if you use the second way, apache will open "test" folder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant