Each time it's time to deploy a CodeIgniter application, I find myself struggling with changing the path in the .htaccess. Therefore; I'm looking for a proper, good working solution which works no matter of the location of the actual project.
Obstacle: My local testing enviroment isn't localhost/ but rather localhost/project. This won't, most likely, be the case in the live enviroment (more likely /). Hence, I'd prefer a solution which works anyway.
My current .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /project/index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /project/index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /project/index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /project/index.php
</IfModule>
Using only index.php as a path won't work. It gives me an 404 not found error. Have tried a lot of different combinations, and would love to see your suggestions. Thanks!