【问题标题】:Re-writing to remove index.php, not working properly Kohana重写以删除 index.php,无法正常工作 Kohana
【发布时间】:2014-05-07 17:01:19
【问题描述】:

我正在尝试从网址中删除 index.php

现在 Kohana 提供的 URL 前面没有 index.php,但是,这些 URL 将转到未找到的页面。

当我在网址前手动输入index.php 时,/index.php/login 之类的东西会起作用

但系统本身会指向/login,这会导致未找到错误。

我的 .htaccess 文件中有以下内容,从 Kohana 复制

RewriteRule .* index.php/$0 [PT] 这对我没有任何作用。

如果有人对幕后发生的事情有任何线索,那就太好了。

【问题讨论】:

    标签: php .htaccess mod-rewrite kohana


    【解决方案1】:

    试试这个:

    # ----------------------------------------------------------------------
    # Start rewrite engine
    # ----------------------------------------------------------------------
    
    # Turning on the rewrite engine is necessary for the following rules and features.
    # FollowSymLinks must be enabled for this to work.
    
    <IfModule mod_rewrite.c>
     # Make sure directory listing is disabled
    Options +FollowSymLinks -Indexes
    RewriteEngine on
    
    # Send request via index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    
    RewriteRule ^(.*)$ index.php/$1 [L]
    
    
    
    </IfModule>
    

    如果仍然无法使用,请在 RewriteEngine on 之后添加此行

    RewriteBase /
    

    RewriteBase /your-application-folder/
    

    【讨论】:

    • @user1952811 你是否在你的 apache 服务器中启用了“mod_rewrite”??
    • @user1952811 你试过这种方式吗?? kohanaframework.org/3.0/guide/kohana/tutorials/clean-urls
    • 是的,我创建了一个 phpinfo() 文件。以下是加载的模块: core mod_so mod_watchdog http_core mod_log_config mod_logio mod_version mod_unixd mod_access_compat mod_alias mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_host mod_authz_user mod_autoindex mod_deflate mod_dir mod_env mod_filter mod_mime prefork mod_negotiation mod_php5 mod_rewrite mod_setenvif mod_php5 mod_rewrite mod_setenvif
    猜你喜欢
    • 2011-10-03
    • 2011-06-14
    • 2019-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多