I want to remove /public/index.php
from my Codeigniter and Bonfire project URLs..
My current URL: http://localhost/public/index.php/page
Desired URL: http://localhost/page
but I want the paths for link and images and robots intact! How does one do that? Any good resources for working with .htaccess?
Advertisement
Answer
I think you have to take following steps:
-
Shift your .htaccess file from application to root directory
-
Remove/comment old code (using #) in old file and paste below code
RewriteEngine on
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [PT,L]
RewriteRule ^/?ajax/(.*)$ ajax.php?$1 [NC,QSA,L]
-
Remove index.php from config file against $config[‘index_page’] like below $config[‘index_page’] = ”;
-
Then activate rewrite module from Apache
It should work for you.