views:

339

answers:

1

Codeinginter provide .htaccess file as explained below. It is from CI User Guide.

However when I add this file in xampp/htdocs/mycodeigniter, and point to http://127.0.0.1/mycodeigniter/somepage, it goes to http://127.0.0.1/xampp which is the root file in htdocs.

How can I fix the file so that it points to http://127.0.0.1/mycodeigniter/somepage?

++++++++++++

By default, the index.php file will be included in your URLs: example.com/index.php/news/article/my_article

You can easily remove this file by using a .htaccess file with some simple rules. Here is an example of such a file, using the "negative" method in which everything is redirected except the specified items:

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

In the above example, any HTTP request other than those for index.php, images, and robots.txt is treated as a request for your index.php file.

+1  A: 

Try a relative substitution path:

RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Gumbo