CodeIgniter Forums
I hope it can help you! It is about the index.php. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: I hope it can help you! It is about the index.php. (/thread-3707.html)



I hope it can help you! It is about the index.php. - El Forum - 10-17-2007

[eluser]fanxiaotao[/eluser]
I hope it can help you!

Somebody ask the question:"How can i drop the 'index.php' from the rul".

I will give you my experience.

Show my path of the CodeIgniter:"D:/phpDemo/Root/CodeIgniter/".

Modify the httpd.comf file of Apache Server.

Add code like this : Alias /phpDemo/ "D:/phpDemo/Root/CodeIgniter/index.php/" .

Now the old url:"http://localhost:8000/CodeIgniter/index.php/blog" had changed to :"http://localhost:8000/phpDemo/blog/".

I hope that my experience could help you.

I am a beginning student for the CodeIgniter.

My english is not very well.I hope you can know my saying.


I hope it can help you! It is about the index.php. - El Forum - 10-17-2007

[eluser]nirbhab[/eluser]
hi,

i was facing the problem with 'index.php' in earlier treads i found that we can remove index.php from URL string through .htaccess, now are somehow showed me another sunlight, but my problem resides, as i am working on a domain provided by Domain Hosting Company, so i can change httpd.conf file of Apache or another web server, so i need to change it in my coding or codeigniter configuration files.

Please post if you have any solution.


I hope it can help you! It is about the index.php. - El Forum - 10-17-2007

[eluser]fanxiaotao[/eluser]
Do you ask my about this?

My changing about the config.php file.

My changing is :

$config['base_url'] = "/phpDemo/";
$config['index_page'] = "";

En, i have not test more.

I hope it can help you.

Let us study together.


I hope it can help you! It is about the index.php. - El Forum - 10-18-2007

[eluser]nirbhab[/eluser]
seems that it should work, sry i must say it is working on your side, but i am still facing the same problem:

initial configuration i am currently using are:

$config['base_url'] = "http://localhost/frame";
$config['index_page'] = "index.php";

URL request:
http://localhost/frame/index.php/blog

According to your configuration,

$config['base_url'] = "http://localhost/frame";
$config['index_page'] = "";

than url should be:
http://localhost/frame/blog

according to me url must point to directory named 'blog'.

i hope i understood you properly and i might be able to explain my problem too.
Please help.


I hope it can help you! It is about the index.php. - El Forum - 10-18-2007

[eluser]fanxiaotao[/eluser]
The httpd.conf file is to node.

Add code like this : Alias /phpDemo/ “D:/phpDemo/Root/CodeIgniter/index.php/”

When you modify the file like this.

Your old url will change.

egg:

old url:http://localhost:8000/CodeIgniter/index.php/blog

new url:http://localhost:8000/phpDemo/blog/


Note the "phpDemo" , it is have equaled the "CodeIgniter/index.php",

The ’base_url’ will change to "http://localhost:8000/phpDemo/".

You can try more.

Your error maybe is the "/" at the last.

I believe that you will successful.

I would go home,now is 17:34.

I am in BeiJing ,China.

Good Luck for you.


I hope it can help you! It is about the index.php. - El Forum - 10-18-2007

[eluser]Jon Braud[/eluser]
Using a .htaccess file is the easiest way to go about it in my opinion.

in your website root directory (the one with your index.php file) save a file named ".htaccess" with this content:

RewriteEngine on
RewriteRule ^$ /index.php [L]
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]

That will re-write the URL to exclude the "index.php", you don't want to be deleting the index page variable from the config file as CI needs to know what it's index page is. =)

Hope that helps.


I hope it can help you! It is about the index.php. - El Forum - 10-18-2007

[eluser]nirbhab[/eluser]
Please check this:
This might help you guys to actually understand my problem.

Index.php

Sorry my english is poor.


I hope it can help you! It is about the index.php. - El Forum - 10-21-2007

[eluser]fanxiaotao[/eluser]
I hope that i guess your mean.

You want change http://localhost/index.php/CLASS/FUNCTION to http://localhost/CLASS/FUNCTION.

My demo is have "phpDemo" that is not you want.

You can modify the file httpd.conf like this
Alias / “D:/phpDemo/Root/CodeIgniter/index.php/”.

Now, your url is will change to http://localhost/CLASS/FUNCTION

If you want to change url "http://localhost/" to your want first page, you can modify the file "CodeIgniter\system\application\config\routes.php" like this
"$route['default_controller'] = "blog"; ". The "blog" is the name of the file "CodeIgniter\system\application\controllers\blog.php".

I hope your problem had resolved.

Good luck for you.


I hope it can help you! It is about the index.php. - El Forum - 10-22-2007

[eluser]Paul Scott[/eluser]
To do this entirely with a .htaccess is considerably simpler than using apache httpd.conf. The example for the .htaccess in the wiki is assuming that your CI application will go into the root of your domain, however, this is not how I wanted it when I was working on my application.

To account for this, I changed the .htaccess to support the following types of URL:
http://localhost/projects/projectname/index.php/controller/method

Code:
RewriteEngine on
RewriteBase /projects/projectname/
RewriteCond $1 !^(index\.php|images|robots\.txt|files)
RewriteRule ^(.*)$ index.php/$1 [L]

Note: You need to have the apache module `mod_rewrite` installed.
Hope that helps somebody