【问题标题】:How to 301 redirect in htaccess from old url with parameters to new?如何在htaccess中从带有参数的旧网址301重定向到新网址?
【发布时间】:2016-09-25 07:44:27
【问题描述】:

我想从旧网址重定向到新网址 像这样

旧:

uae/brand/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ product-details.php?product=$3&id=$2&brand=$1

新:

RewriteRule ^uae/brand/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ product-details.php?product=$2&brand=$1

【问题讨论】:

标签: php .htaccess url url-redirection


【解决方案1】:

您可以将此规则用作站点根目录 .htaccess 中的第一条规则:

RewriteEngine On

RewriteRule ^(uae)/.+/([\w-]+)/?$ /$1/$2 [L,NC,R=301]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-16
    • 1970-01-01
    • 2021-06-22
    • 2016-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多