IIM NUR DIANSYAH
IIM NUR DIANSYAH

Reputation: 432

how to remove public folder and index.php on bonfire?

I just installed bonfire, if I want manage a module I must go to

http://localhost/bonfire/public/index.php/admin/content/blog

I would like to remove index.php on the url and I would like to access my module like.

http://localhost/bonfire/admin/content/blog

Any ideas? i have googling and try any tutorials to remove index.php but it still failed until now

Upvotes: 0

Views: 3027

Answers (3)

user4094161
user4094161

Reputation:

Below are the steps of removing public and index.php from the website / application

  1. Move all files from public folder to the root (using older site structure).
  2. Edit root index.php and set $path = “.”;
  3. Rename 1.htaccess to .htaccess
  4. Edit .htaccess line 158 Rewrite-base / (add sub folder path if site hosted under sub directory)
  5. Open config.php in folder application/config and set $config[“base_url”] = “” and $config[“index.php”]=””

With these changes your CI Bonfire application will now have more user friendly urls.

Upvotes: 0

Arvind Jaiswal
Arvind Jaiswal

Reputation: 442

Add this code in your .htaccess file and place it on root directory

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

And change in your config file with this

$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

Upvotes: 0

PHPExpert
PHPExpert

Reputation: 943

Do add below code into the your .htaccess file. It will remove public/index.php from url

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

If .htaccess file is not present then do create it. And after adding this code if still not working then contact with server admin to make working this file.

Upvotes: 0

Related Questions