i've searched the forum & it seems to me that this is the best file structure to adopt.
c:/wamp/www/CodeIgniter/public_html/index.php, and .htaccess(this is a blank file)

OS: windows
browser: firefox
environment: WAMP

$system_folder = "../system";
$application_folder = "c:/wamp/www/CodeIgniter/application/project1";

$config['base_url'] = "http://localhost/CodeIgniter/public_html";
$config['index_page'] = "index.php";
$config['uri_protocol'] = "AUTO";

$route['default_controller'] = "General";

I've setup as above and all is running ok.
Now i want to remove the index.php from the URL which i'm still having problem after much research on the forum. Any assistance/guidance is appreciated.
From http://localhost/CodeIgniter/public_html/index.php/general/login_form.html
to http://localhost/CodeIgniter/public_html/general/login_form.html


[eluser]Thorpe Obazee[/eluser]
have you checked the user_guide?

after another few hours of searching the forum, i solved it by:
- changing the httpd.conf in apache,
FROM #LoadModule rewrite_module modules/
TO LoadModule rewrite_module modules/

- input the following code in .htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA]

since i have my /system folder 1 level up of index.php, how can i access the php files?
i tried to use include, but CI doesn't seems to allow it.
Message: include() [function.include]: URL file-access is disabled in the server configuration
any alternative way to do this, thanks.

Never use http:// includes, they R evil! Smile Just use relative or absolute path to the script and it will work.

can you point me to the user guide where i can understand more on the relative path, thanks

Its not in the guide. Its universal Smile

For example in the config:

$system_folder = "../system";
$application_folder = "c:/wamp/www/CodeIgniter/application/project1";

$system_folder is assigned in this case with relative path and $application_folder with absolute path. Relative path is, well relative to the script that is using it Smile

Reason why you cant(well you can if you set allow_url_include to on) use include() function with URL is that its very unsecure and basicly hackers could execute harmful code in your server. For example this:
// This trusts input from user. No checkings whatsoever.
..would be a dream come true for hackers. They could just add "?page=" to the end of your script and it would be parsed with PHP from YOUR server.
This kind of unsecure coding can still be found on the internetsites and usually when hackers discover this kind of script, they will use exploits like this to send spam etc.

i have a html form, the form will be validate by this file located at ../system/plugins/validate.php
eg. action = "../system/plugins/validate.php"
in this way my directory structure will be visible to all when they see the html code.
this is what i'm trying to prevent by moving the /system folder up by 1 level above the web root.
i only know using include method which can't be use and better not to use it as you have explained above, is there another way to do it? To execute a file in the /system folder and not exposing the directory structure to the public? Many thanks for your patience and guidance.

[eluser]Đaяк Đaηтє[/eluser]
Hello my Friend:

I had the same problem, but I've solved using .htaccess file, with the next content:

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

I save the .htaccess file in the root directory of my application, at the same level of the system folder.

If you need more information you can follow the next thread:


your solution to my initial problem had been solved it in post 2.
my new problem is in post 3 onwards, thanks.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.