【问题标题】:Codeigniter in subdomain gives the index of page instead of the index.php子域中的 Codeigniter 给出页面的索引而不是 index.php
【发布时间】:2013-07-19 01:26:26
【问题描述】:

我有一个使用 CI 2.1.3 开发的网站

这是我在 localhost 的文件夹结构:

/mysite
       /application
       /system
       /public_html
                   /index.php
                   /assets

public_html 文件夹中,我有以下.htaccess 文件:

RewriteEngine on
RewriteBase /test/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Options -Indexes
AddDefaultCharset utf-8

我在名为dev 的实时服务器上创建了一个子域。 它的目录是public_html/dev

我把网站上传到了这个目录。

尝试访问该站点时,我得到了 / 页面的索引,并且我看到了 dev 中的目录,但没有看到该站点。

知道如何解决这个问题吗?

我尝试更改配置文件中的 base_url,它是空的,但没有帮助。
我在htaccess文件中尝试了各种组合,没有任何效果。

有人可以帮忙吗? 我也试过不使用 RewriteBase。 我也试过了:

DirectoryIndex index.php

DirectoryIndex public_html/index.php

【问题讨论】:

    标签: .htaccess codeigniter subdomain


    【解决方案1】:

    尝试将重写规则更改为

    RewriteRule ^(.*)$ /index.php/$1 [L]
    

    希望对你有帮助

    【讨论】:

    • 好的,dev文件夹实际上在根文件夹中。我现在将它移到 public_html 文件夹,并将 RewriteRule 更改为您的建议,现在我找不到 404 页面。如果我去 mysite.co.za/dev 我会再次获得页面索引。
    • 我可以得到你的应用程序的网址吗?
    • 同时删除 .htaccess 的所有内容并添加以下内容并试一试: RewriteEngine on RewriteCond $1 !^(index\.php|assets|robots\.txt) RewriteRule ^(.*) $ /index.php/$1 [L]
    猜你喜欢
    • 2016-07-29
    • 1970-01-01
    • 1970-01-01
    • 2010-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-16
    • 1970-01-01
    相关资源
    最近更新 更多