• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I hope it can help you! It is about the index.php.

#1
[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.

#2
[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.

#3
[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.

#4
[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.

#5
[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.

#6
[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.

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

Index.php

Sorry my english is poor.

#8
[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.

#9
[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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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