重定向不同的URL

时间:2018-05-20 07:07:15

标签: wordpress .htaccess redirect woocommerce

我正在尝试重定向

https://www.fabricdeluxe.com.au/wishlist/*randomly-generated-url

https://www.fabricdeluxe.com.au/my-account/#1526261943144-4a3b22f0-c3d2

我在.htaccess中尝试了以下代码,但它不起作用。

# BEGIN WordPress
<IfModule mod_rewrite.c>
RedirectMatch 301 ^/wishlist/.*$ http://www.fabricdeluxe.com.au/my-account/#1526261943144-4a3b22f0-c3d2
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

非常感谢任何帮助!

P.S。我还安装了Redirection插件,所以如果我能以某种方式通过该插件实现重定向,那也很棒!

1 个答案:

答案 0 :(得分:0)

确保首先启用Apache重写模块,然后将重定向放在它们下面:

Options +FollowSymLinks
RewriteEngine On
RedirectMatch 301 ^/wishlist^wishlist/.*$ http://www.fabricdeluxe.com.au/my-account/#1526261943144-4a3b22f0-c3d2 [R=301,L, NE]

或作为替代方法:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^wishlist/.*$ http://www.fabricdeluxe.com.au/my-account/#1526261943144-4a3b22f0-c3d2 [R=301,L,NE]