I’m trying to access CodeIgniter URLs without ‘index.php’. Here’s the steps I’ve taken:
-
Checked mod_rewrite is enabled – I set a rule to redirect all requests to google, which worked. Also checked that ‘AllowOverride All’ was set
-
Added an .htaccess file with the following:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] -
Set my directory structure on the webserver as follows:
/home/wwwsunde/ -> application -> system -> public_html -> index.php -> .htaccess -
Updated my application/config files so that the system and application paths are ‘../system’ and ‘../application’
-
Try to access the site from 2 URLs
http://109.234.194.207/~wwwsunde/index.php/welcome/membership WORKS http://109.234.194.207/~wwwsunde/welcome/membership DOES NOT WORK -
I’ve also set CodeIgniter’s index page variable to blank as per the guide
The error message shown:
The requested URL /home/wwwsunde/public_html/index.php/welcome/membership was not found on this server.
I’m out of ideas as to what could be wrong – it’s an Apache or server issue but I’m not sure what…
Oh… I know why… make this your rewrite rule:
The [L] you had was just a ‘last rule’ but wouldn’t do the quit rewrite you want to quietly handle the background shell game. It would be an endless loop. If this doesn’t work, specify the full URL in the rewrite like: