【问题标题】:htaccess rewrite syntax for masking an URL用于屏蔽 URL 的 htaccess 重写语法
【发布时间】:2013-02-09 09:57:04
【问题描述】:

您好,我需要每次用户进入 www.mydomain.com/page 他们被重定向到 www.mydomain.com/portal/index.php?option=com_content&id=84 但顶部的 URL 必须保留 www.mydomain.com/page

我在我的 htaccess 中尝试了很多东西。只是能够重定向,但不能屏蔽 url..

这是我的代码。

Redirect 301 /page http://www.mydomain.com/portal/index.php?option=com_content&id=84

RewriteEngine on
RewriteBase /
RewriteRule ^/portal/index.php?option=com_content&id=84$ /page

【问题讨论】:

    标签: .htaccess redirect rewrite


    【解决方案1】:

    RewriteRule 的想法是正确的,只是它是倒退的。最终用户的 URL 位于左侧,重写后的 URL 位于右侧。 Redirect 301 应该被完全删除,因为这会改变浏览器的 URL。

    RewriteEngine On
    RewriteRule ^page$ portal/index.php?option=com_content&id=84 [L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-02
      • 1970-01-01
      • 2011-02-16
      • 1970-01-01
      • 2019-09-20
      • 1970-01-01
      • 2021-10-13
      • 1970-01-01
      相关资源
      最近更新 更多