【问题标题】:htaccess vhost codeigniter index.phphtaccess vhost codeigniter index.php
【发布时间】:2013-10-21 08:38:05
【问题描述】:

我已经阅读了很多相同问题的主题,但我没有找到解决方案...请帮助我。我有一盏灯进入 ubuntu 服务器。我的文档根目录是 /home/utente/ 进入这个目录我有另一个带有 codeigniter Web 应用程序的目录 (turni)。 Web 应用程序可以在 url 中添加“index.php”,但我想消除它。我有这个配置:

config.php 进入codeigniter:

$config['index_page'] = '';

.htaccess:

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

/etc/apache2/sites-available/默认:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /home/utente
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /home/utente/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

当我在 url 中打开一个没有 eh“index.php”的 Web 应用程序链接时,服务器出现此错误:在此服务器上找不到请求的 URL /turni/auth/login。

为什么???如果我把 index.php 像 /turni/index.php/auth/login 一样工作正常.... 感谢您的帮助,对不起我的英语:D

【问题讨论】:

    标签: apache .htaccess codeigniter ubuntu


    【解决方案1】:

    将 .htaccess 添加到您的服务器根目录并将重写基础更改为

    RewriteBase /turni
    

    假设您的 codeigniter 存在于 /var/www/turni

    【讨论】:

    • 感谢您的回复!我试过了,但它什么也没改变
    猜你喜欢
    • 2019-04-06
    • 2016-05-13
    • 2012-08-15
    • 2015-03-09
    • 2023-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-11
    相关资源
    最近更新 更多