【问题标题】:CodeIgniter URLs File not found on Linux Apache2在 Linux Apache2 上找不到 CodeIgniter URLs 文件
【发布时间】:2014-09-23 03:45:10
【问题描述】:

无法让我的控制器在 Linux apache2 上运行(从 WAMP 转移)

config.php

$config['base_url'] = 'http://subdomain.domain.com/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

apache2 日志

[Tue Sep 23 03:36:08 2014] [error] [client 192.168.1.1] File does not exist: /var/www/subdomain.domain.com/execute

apache2 配置

<VirtualHost *:80>
    ServerName subdomain.domain.com
    DocumentRoot /var/www/subdomain.domain.com

    <Directory /var/www/subdomain.domain.com>
            Options Indexes FollowSymLinks           
            AllowOverride All 
            Order allow,deny
            Allow from all
    </Directory>
</VirtualHost>

.htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

不确定出了什么问题。

【问题讨论】:

    标签: php apache codeigniter


    【解决方案1】:

    将您的 .htaccess 文件更改为:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    

    在你的配置文件中,试试这个:

    $config['uri_protocol'] = 'AUTO';
    

    这可能会解决你的问题。

    【讨论】:

    • 这就是答案。谢谢你。特别是 .htaccess 中的“RewriteBase /”条目。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-03
    • 2016-01-25
    • 2023-04-10
    • 1970-01-01
    • 2018-08-21
    • 2021-07-23
    • 1970-01-01
    相关资源
    最近更新 更多