【发布时间】:2013-07-31 20:15:38
【问题描述】:
假设我有以下网址
subdomain.example.com/myfolder
其中“myfolder”是我的 CI 安装的根文件夹(应用程序文件夹所在的位置)。
我有以下 .htaccess(感谢 Fabdrol 和 ElliotHaughin):
<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>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
当我尝试访问我的网站时,例如:
subdomain.example.com/myfolder/controller/etc...
它总是返回 5xx 内部服务器错误。但是,如果我添加
subdomain.example.com/myfolder/index.php/controller/etc...
完美运行。我很确定我的 .htaccess 有问题我只是看不出问题出在哪里。
谁能帮我修复我的htaccess?谢谢
* 仅供参考 * 我还尝试在我的 config.php 上更改以下行
$config['index_page'] = ''; // Originally set to index.php
$config['uri_protocol'] = 'REQUEST_URI' // Originally set to AUTO
当我改变:
RewriteEngine On
RewriteBase /myfolder
但它不会返回 500,它根本不显示任何内容。
只是提供一些有关myfolder结构的信息
public_html
---|
|
|--mysubdomain_folder
| |
|-----|--myfolder (my website where index.php, .htaccess and application folder are).
【问题讨论】:
-
@MadanSapkota 我试过了,但没有运气。 .htaccess 配置在我的其他站点(非子域站点)上完美运行。
-
您的 httaccess 文件在 Web 根目录或 CI 根目录中的什么位置?
-
ci root,我把它和 index.php 文件,控制器文件夹和其他东西放在一起。
标签: php .htaccess codeigniter