【问题标题】:How do I setup CodeIgniter htaccess in a sub-folder?如何在子文件夹中设置 CodeIgniter htaccess?
【发布时间】:2018-11-05 03:15:47
【问题描述】:

我在我的服务器上通过以下 URL 设置了 CodeIgniter 应用程序:

http://subdomain.domainame.com/something1/something2/

(我以something1和something 2为例)

现在,我可以在使用上述 URL 时完美访问应用程序,并且可以在末尾添加 /index.php/controller/action 等。

我尝试在托管应用程序的同一目录中设置一个 .htaccess 文件,但它似乎不起作用。

.htaccess 文件包含以下内容:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ something1/something2/index.php?/$1 [L]

这给了我一个 500 内部服务器错误。

任何人都可以对此有所了解吗?

【问题讨论】:

    标签: php apache .htaccess codeigniter mod-rewrite


    【解决方案1】:

    我想我可能已经解决了这个问题。

    改变:

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

    收件人:

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

    我不再收到内部服务器错误。

    为了帮助遇到这个问题的人,这是我的完整 .htaccess 文件:

    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteRule ^(.*)$ /something1/something2/index.php?/$1 [L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-25
      • 1970-01-01
      • 2011-11-23
      • 2013-02-28
      • 1970-01-01
      • 1970-01-01
      • 2021-11-26
      • 2011-06-01
      相关资源
      最近更新 更多