kenjis / codeigniter-composer-installer

Installs the offical CodeIgniter 3 with secure folder structure via Composer
MIT License
377 stars 118 forks source link

dot.htaccess install template file got a little bit more security #4

Closed j0inty closed 7 years ago

j0inty commented 8 years ago

Hi,

I found this .htaccess file some days in a forum and use it for all my I projects running with apache webserver.

Hope it helps a little bit ;)

regards j0inty

kenjis commented 8 years ago

@j0inty

Thank you for your feedback.

But your htaccess is for the default folder structure of CodeIgniter.

This installer changes folder structure. That is, it moves index.php into public folder. In the folder, there is no system and application folders.

And this installer assumes you set the public as your web root (document root). If you set your web server correctly, there is no way to access system and application folders via HTTP.

The other differences are the ? in RewriteRule ^(.*)$ index.php?/$1 [L] and RewriteBase /. I'm not sure we need them.

ankurk91 commented 8 years ago

@kenjis It is good to check if a module is enabled or not; otherwise apache may throw errors (Internal Server Error, 500), which is hard to debug sometimes. For example : WordPress also do this, see here

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

Just add if condition and you are good to go.

kenjis commented 7 years ago

@ankurk91 Thank you for your comment. I added <IfModule>.