【问题标题】:Rewrite rule for https://mysite.com/aboutus.page to https://mysite.com/adoutus.php to [closed]将 https://mysite.com/aboutus.page 的规则重写为 https://mysite.com/adoutus.php 到 [关闭]
【发布时间】:2013-09-12 16:02:18
【问题描述】:

我想应用一个读写规则来将https://mysite.com/aboutus.php 的重写规则转换为https://mysite.com/aboutus.page,我在 .htaccess 文件中包含以下内容,但它不起作用。

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://mysite.com/$1 [R,L]

【问题讨论】:

    标签: apache .htaccess mod-rewrite


    【解决方案1】:

    首先,您检查port 80,这不会发生,因为您使用了https

    试试这个:

    RewriteEngine On
    RewriteCond %{HTTPS} =on
    RewriteRule ^/?aboutus\.page$ https://mysite.com/about\.php [R,L]
    

    未经测试。另外由于主题说一种方式,而任务文本另一种方式我不知道你想要什么。:)

    【讨论】:

    • 它重定向到同一页面,我希望显示的 URL 为“mysite.com/about.page”。
    • aboutus.phpabout.page?
    • 是的,我希望 url 是 about.page。
    • 更新了我的回复。应该将 https 调用(不是 http)重定向到 aboutus.page 到 about.php。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-18
    • 1970-01-01
    • 2020-11-28
    • 1970-01-01
    • 2013-06-02
    • 1970-01-01
    • 2017-01-17
    相关资源
    最近更新 更多