.htaccess和index.php的问题

时间:2011-08-23 05:37:53

标签: php .htaccess codeigniter mod-rewrite

在我的开发服务器中,引荐来源名称看起来像dev.host.in,而ip看起来像123.456.456.111/dev/

我正在使用codeigniter框架。我已将.htaccess文件设置为删除index.php。当我通过dev.host.in/testproject/访问网站时工作正常。但是当我使用123.456.456.111/dev/testproject/访问它时,它不显示页面。 但是当我访问123.456.456.111/dev/testproject/index.php时,我正在访问该网站。

如何解决此问题?

1 个答案:

答案 0 :(得分:1)

将它放在.htaccess文件中:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

如果您仍然遇到问题,请访问此link