【问题标题】:change web Url to another Url using .htaccess? [duplicate]使用 .htaccess 将 web Url 更改为另一个 Url? [复制]
【发布时间】:2014-06-25 08:50:42
【问题描述】:

我有 centos 服务器,我想在地址栏中看到我的 websile url 和 /index.php

当我尝试访问我的网站www.example.com 时,我想在地址栏中看到网页的网址应该是www.example.com/index.php

我希望它可以通过配置 .htaccess 文件来工作。我不熟悉.htaccess。

【问题讨论】:

    标签: php .htaccess yii url-rewriting centos


    【解决方案1】:
    RewriteRule ^$ /index.php [L,R=301]
    

    【讨论】:

    • 但地址栏中仍然是shows www.example.com
    • 您能告诉我^$ 的作用是什么吗?请。
    【解决方案2】:

    如果 index.php 在 DirectoryIndex 列表中,您正在执行不必要的重定向/重写。

    【讨论】:

    • 是的,我知道。但我想在地址栏中显示该网址。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-04
    • 2020-08-25
    • 2021-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多