0

I am new to Codeigniter. I want to make safe to the model, controller and views. I have found that it is good to put the index.php in a folder of public like below.
--root
  --application
  --public
      --css
      --js
      --assets
      --index.php (the Codeigniter base index.php)
      --.htaccess
  --system
.htaccess
What should I do for the file that bold,so that when I enter the "example.com/controller/method" can see my page. I don't want "example.com/index.php/controller/method" I hope you got the questions.

[edit] I add more to explain.
I know how to hide index.php

example.com/public/controller/method => got the page
example.com/controller/method => can't got the page

I want the second one can show the page if I put the index.php into public folder!

2
  • It means Are you trying to remove index.php in your url ? Commented Nov 13, 2015 at 9:54
  • Then what do you mean by bold ? Commented Nov 13, 2015 at 10:08

3 Answers 3

0

In the index.php you should change the $system_path and the $application_folder variables, and thats should do it.

In your case:

$system_path = '../system';
$application_folder = '../application';

And of course your document root must to point to your public folder. Hope it helps.

Sign up to request clarification or add additional context in comments.

Comments

0

I'm not sure what you want to achieve;

if you want to remove index.php from the url so you have

example.com/controller/method instead of example.com/index.php/controller/method

You need to create a .htaccess file

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?r=$1 [L,QSA]

Comments

0

For me, if you want to make it safer... I advised you to rename

application folder and system folder

E.g:

application change to my_secret_application

and

system change to my_secret_system

And in your index.php

$system_path = 'my_secret_application';
$application_folder = 'my_secret_system';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.