【发布时间】:2017-04-20 17:56:12
【问题描述】:
如果用户尝试使用包含“/product/”的 url 访问页面并收到 404 错误,我会尝试重定向到特定页面(商店页面)。
这是我目前在我的 htaccess 中拥有的:
重写规则 ^/product/.* /store [R=404,L]
我需要进行哪些更改才能使其正常工作?
这是我当前的 htaccess 文件:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ www.mydomain.com/$1 [R=301,L]
# Send surplus store 404 errors to the store home page
ErrorDocument 404 /store
RewriteEngine On
RewriteRule ^/?product(/.*)?$ - [R=404,L,NC]
# handle both specific URL redirects for woocommerce
RewriteRule ^/?product-(?:tag|categories|category)/([\w-]+) www.mydomain.com/parts?category=$1 [R=301,L,NC,QSA]
# 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]
</IfModule>
# END WordPress
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
RewriteRule ^MyAccount\.aspx\/?(.*)$ "http\:\/\/online\.mydomain\.com\/$1" [R=301,L]
【问题讨论】: