Codeinginter提供.htaccess文件,如下所述。它從CI User Guide。如何修改.htaccess,使其指向codeigniter中的子文件夾
但是,當我在xampp/htdocs/mycodeigniter中添加此文件並指向http://127.0.0.1/mycodeigniter/somepage時,它將轉到http://127.0.0.1/xampp這是htdocs中的根文件。
如何修復該文件使其指向http://127.0.0.1/mycodeigniter/somepage?
++++++++++++
默認情況下,index.php文件將被包含在你的URL: example.com/index.php/news/article/my_article
您可以通過使用帶有一些簡單規則的.htaccess文件輕鬆刪除此文件。下面是這樣一個文件的一個例子,使用「負」的方法中,一切都被重定向除指定的項目:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
在上述例子中,比那些的index.php,圖像之外的任何HTTP請求時,而robots.txt被視爲您的index.php文件的請求。