【发布时间】:2014-11-10 07:37:11
【问题描述】:
我正在使用 Ubuntu。服务器也是linex。我的框架是codeigniter。
我的.htaccess 代码在本地工作,但不在服务器上。
我正在使用 .htaccess 删除 index.php
我的服务器网址就像 http://xx.xxx.xxx.xxx/foldername/index.php/signup 。这里 xx.xxx.xxx.xxx 是 http_host。
我的 .htaccess 代码是
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /foldername/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L,QSA]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
我已经在$config['index_page'] = '';中设置了配置
所有代码都在本地主机上运行。但在服务器上它不起作用。
请告诉我如何从 url 中删除 index.php ?
【问题讨论】:
-
你的网址是
/index.php/signup??通常 index.php 配置为 index.html 之后的默认文件,所以只需尝试删除 index.html。
标签: php .htaccess codeigniter