【问题标题】:Wordpress HTACCESS 301 Redirect Querystring index.aspWordpress HTACCESS 301 重定向查询字符串 index.asp
【发布时间】:2016-10-11 14:59:44
【问题描述】:

我有一个基本的 WordPress HTACCESS。我想要完成的是来自以下位置的 301 重定向:

/index.asp?id=herhaalrecept_aanvragen-5

https://www.example.nl/aanmelden-nieuwe-patienten/

我用 QUERYSTRING 尝试了很多选项,但没有成功。我从下面的示例中删除了它,因为我认为它甚至不接近。

有人有想法吗?

提前发送

下面是我的 HTACCESS 示例:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php? [L]

Redirect 301 /index.asp?id=herhaalrecept_aanvragen-5 https://www.example.nl/aanmelden-nieuwe-patienten/

</IfModule>
# END WordPress

【问题讨论】:

    标签: wordpress .htaccess redirect query-string


    【解决方案1】:

    RedirectRewriteRule 与查询字符串不匹配。您需要RewriteCond,为此您还必须在其他 WP 规则之前保留该规则。

    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{QUERY_STRING} (?:^|&)id=herhaalrecept_aanvragen-5(&|$)  [NC]
    RewriteRule ^index\.asp$ https://www.example.nl/aanmelden-nieuwe-patienten/? [L,R=301,NC]
    
    RewriteRule ^index\.php$ - [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php? [L]
    

    【讨论】:

      猜你喜欢
      • 2017-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-02
      • 2012-08-16
      • 2014-11-11
      • 2015-05-27
      相关资源
      最近更新 更多