【发布时间】:2012-02-06 01:19:08
【问题描述】:
我刚刚完成了我的网站,使用 codeigniter,我将该网站作为插件域上传到了 bluehost 帐户
我不使用 query_strings,这是我的配置文件中的位置:
$config['enable_query_strings'] = FALSE;
该网站在我的测试服务器上运行良好,但将其上传到我的 bluehost 帐户,我在尝试导航任何页面时遇到一些问题,否则主页
问题是在主机的根目录中存在另一个 codeigniter 网站并具有 .htaccess 文件以使其正常工作,因此在创建指向主域站点内的文件夹的新站点时,我认为存在问题使用我的插件站点的 .htaccess
这是我的插件站点的 .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /http://www.mydomain.com/
#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_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#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>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
【问题讨论】:
-
一次注释掉一行,哪一行导致 500 错误,重写基础看起来也很可疑,但我 100% 确定
-
重写基础
RewriteBase /http://www.domain.com/???? -
@Bookf of Zeus:是的,我认为它使重定向混乱,可能无法访问或内部循环?
-
RewriteBase /sample-domain.com
-
RewriteBase 可以是 / 但只需将 DirectoryIndex 设置为应用程序索引所在的位置
标签: php .htaccess codeigniter