【问题标题】:Module Url Working On Localhost But Not Working On Server模块 URL 在本地主机上工作但在服务器上不工作
【发布时间】:2012-11-13 17:47:49
【问题描述】:

我已经通过 gii 生成了一个模块管理员并添加了基于模块的身份验证。应用程序在虚拟主机上运行

www.localhost.com

它的模块在 localhost 中通过 url 工作正常

www.localhost.com/admin

www.localhost.com/admin/default

但是当我在服务器上上传模块并通过 url 访问时,它会给出错误 404。 我也在另一台服务器上检查过它。 我的 config/main.php 为

'urlManager'=>array(
                    'urlFormat'=>'path',
                    'showScriptName'=>false,
                    'rules'=>array(
                            '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                            '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
                    ),
            ),

和 .htaccess 文件作为

    Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

请告诉我我缺少什么。

【问题讨论】:

    标签: url-rewriting yii url-routing


    【解决方案1】:

    您可能需要重写基本路径。试试这个:

    RewriteEngine On
    RewriteBase /
    

    【讨论】:

    • 并检查 mod_rewrite 是否已加载。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-04
    • 2014-01-15
    • 1970-01-01
    • 2015-04-09
    • 2021-03-18
    相关资源
    最近更新 更多