maan81
maan81

Reputation: 3609

Removing public/index.php?

How do we remove the public/index.php from ci-bonfire 0.7 ?

I see there are instructions to remove the root index.php but I am unable to remove the root public/index.php and there are no instructions related to it.

I have tried instructions in http://cibonfire.com/docs/bonfire/removing_index without any success. I keep getting the 404 when I go to

http://localhost/Bonfire-0.7/index.php

but

http://localhost/Bonfire-0.7/public/index.php

works fine.

Upvotes: 2

Views: 1897

Answers (5)

allexiusw
allexiusw

Reputation: 1744

Hello I had this error in CodeIgniter the installation in the server works such the next example:

SERVER_IP/public/index.php/controller/method

But I need

SERVER_IP/controller/method

My Solution is very very simple, my project is in the root directory then I go to the root directory and I have to create a .htaccess file configuration. like this:

<IfModule mod_rewrite.c>
   RewriteEngine On
   //Setting de base URL. 
   RewriteBase /public
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   //Setting the pattern to match 
   RewriteRule ^(.*)$ index.php/$1/ [L]
</IfModule>

The final result is:

Request: SERVER_IP/login => SERVER_IP/public/index.php/login

Request: SERVER_IP/login/doLogin => SERVER_IP/public/index.php/login/doLogin

Request: SERVER_IP/login/logout?noredirect=1 => SERVER_IP/public/index.php/login/logout?noredirect=1

Good Luck...

Upvotes: 0

FaridAstorga
FaridAstorga

Reputation: 1

To remove public/index.php in Remote WebServer (in production)

Step 1: Goto application/config/config.php, remove "index.php" from index-page config.

$config['index_page'] = ""; (line 35)

Step 2: Remove index.php and .htaccess in your / (root)

Step 3: Move all files from /public folder to / (root).

Step 4: Update the new index.php in / as the following

$path = "."; (line 74)

It's all! Be happy!

Upvotes: 0

justinw
justinw

Reputation: 710

I'm using XAMPP + bonfire v0.7, I've installed it under a subdirectory called "ci-bonfire", this is my solution.

To remove index.php in URL

Step 1: Goto ci-bonfire/application/config/config.php, remove "index.php" from index-page config.

$config['index_page'] = "";

Step 2: Change 1.htaccess in ci-bonfire/public/ to .htaccess update line #158, change to your subdirectory name

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On
  RewriteBase /ci-bonfire
  RewriteCond %{REQUEST_URI} ^bonfire/codeigniter.*
  RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>

and further down to line #182, prepend "public" to "index.php"

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

To remove public/index.php in URL

Step 1: Goto ci-bonfire/application/config/config.php, remove "index.php" from index-page config.

$config['index_page'] = "";

Step 2: Rename (for backup purpose) or remove index.php and .htaccess in your subdirectory, ci-bonfire

Step 3: Then refer to "Reverting To Traditional Structure" in this cibonfire's documentation. Move all files from public folder up 1 level to your subdirectory.

Step 4: Update index.php as the following

$path = ".";

Hope it helps, it works for me :)

Upvotes: 0

galax
galax

Reputation: 1

Try:

IR Carpeta : public/ Go folder public/

rename the public/ 1.htaccess to .htaccess

http://cibonfire.com/docs/developer/removing_index

Edit the .htaccess file and to add a RewriteBase option pointing to the folder that you're using around line 151 to 165 replace.

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /public

Upvotes: -1

Moeed Farooqui
Moeed Farooqui

Reputation: 3622

Open directory application/config/config.php and do the following:

$config['index_page'] = '';

Upvotes: 0

Related Questions