【发布时间】:2017-06-28 15:55:27
【问题描述】:
我在http://www.ssdpsjal.tk 实现了一个新的.htaccess 文件 我的代码是 -
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ n/index.php/$1 [L]
RewriteRule ^$ /index [L]
Redirect /administrator /sadmin1
我使用 CodeIgniter。您可以访问该网站查看错误。
此外,我已经在我的本地服务器上尝试过这个 .htacccess 并且它没有显示任何此类错误(我认为)
我的文档结构如下
--- ssdpsjal.tk //given by host. Non-writable
--n //the folder where website is stored
--web_based_editor //something my website uses
--.htaccess file //Htaccess file that I told about
--Some other stuff not relevent to the question
编辑
我已经多次更改代码,经过一些更改后,我发现错误发生在RewriteRule ^(.*)$ n/index.php/$1 [L]
注意
RewriteRule ^$ /index [L] 处的index 不是Index.php 它实际上是我的codeigniter 控制器的一个函数(方法)
没有 .htaccess 的实际 URL 是 http://www.ssdpsjal.tk/n/index.php/s/index
注意句末的index,就是那个!
【问题讨论】:
-
你的
error.log说什么? -
我看不到错误日志,因为主机服务提供商不允许我这样做。 (我是免费用户:()
-
RewriteRule ^(.*)$ n/index.php/$1 [L]为什么是这个 n/ ?你只是想绕过显示index.php吗? -
其实
n是我存放网站的文件夹名称!我正在尝试从我的网站 URL 中隐藏/n/index.php
标签: php .htaccess codeigniter codeigniter-3 http-status-code-500