【问题标题】:htaccess redirect with variableshtaccess 使用变量重定向
【发布时间】:2012-02-02 14:09:29
【问题描述】:

我意识到有类似的问题,但我正在尝试找出如何重写以下 URL:

http://www.myWEBaddress.com/?month=200904

http://www.myWEBaddress.com/my-page.php?month=200904 

问候

【问题讨论】:

    标签: apache .htaccess variables redirect


    【解决方案1】:

    将以下内容添加到站点根目录中的.htaccess 文件中。

    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{QUERY_STRING} (^|&)month= [NC] 
    RewriteRule ^ my-page.php [L]
    

    如果要更改用户在浏览器地址栏中看到的 URL,请将最后一条规则更改为

    RewriteRule ^ my-page.php [L,R=301]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-19
      • 1970-01-01
      相关资源
      最近更新 更多