codeigniter 问题 - 迁移后站点重定向到本地主机
我刚刚将 CI 文件从服务器复制到本地主机,但运行该网站时遇到问题。
每当我点击 WAMP 中的站点链接时 http://localhost/CmpOnline/
它显示了与本地主机相同的文件夹列表,
这是我的 htaccess 文件
RewriteEngine on
RewriteCond $1 !^(index\.php|images|javascript|stylesheets|uploads|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
,在配置文件
$config['base_url'] = "http://localhost/CmpOnline/";
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";
我将其更改为所有其他可用选项,但它仍然不起作用
我尝试了这个 .htaccess 和 codeigniter 不工作 还有这个 从 URL 中删除 index.php - Codeigniter 2
但它仍然没有工作。
有什么帮助吗?
i just copied the CI files from server to my localhost and I am having problem running the site.
Whenever i click the site link in WAMP
http://localhost/CmpOnline/
it shows me the same folderlist as on localhost
this is my htaccess file
RewriteEngine on
RewriteCond $1 !^(index\.php|images|javascript|stylesheets|uploads|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
and in the config file
$config['base_url'] = "http://localhost/CmpOnline/";
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";
I changes this to all the other available options but it still does not work
I tried this
.htaccess and codeigniter not working
and this
Remove index.php From URL - Codeigniter 2
But it still does not work.
Any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该有一个
RewriteBase
:因为
RewriteRule
将所有内容发送到RewriteBase
的根目录,默认为/
(CodeIgniter 仍然需要base_url
设置,用于其内部内容)。You should have a
RewriteBase
:since the
RewriteRule
is sending everything to the root ofRewriteBase
, which defaults to/
(CodeIgniter will still need thebase_url
setting, for its internal stuff).如果
将其更改为
如果将其
与重定向或标头位置一起使用到不在 htaccess 中的 url 将不起作用,则必须在 htaccess 中添加 url 才能工作
if
change it to
if use this
with redirect or header location to url not in htaccess will not work you must add the url in htaccess to work