admin管理员组文章数量:1415645
I transfer an old site to wordpress.
The problem is that there are a few links in the web, that are from the old page and need to be transferred to new slugs.
Since I don't want to fill in more plugins to the site just for simple static redirects, I added lines like the following to the < IfModule mod_rewrite.c > section in .htaccess
# END W3TC Browser Cache
# BEGIN W3TC Page Cache core
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=W3TC_ENC:_gzip]
RewriteCond %{HTTP_COOKIE} w3tc_preview [NC]
RewriteRule .* - [E=W3TC_PREVIEW:_preview]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f
RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
# My redirects begin here
Redirect 301 /?page=123 /team/
Redirect 301 /?page=456 /contact/
# ... ect
However when I try
curl -I www.example/?page=123
I get 404 not 301. Also www.example/team/ gives 200.
How can I debug my redirects? Are Redirect 301 in some way affected by the RewriteCond and RewriteRule set that's been added by Wordpress or plugins?
I transfer an old site to wordpress.
The problem is that there are a few links in the web, that are from the old page and need to be transferred to new slugs.
Since I don't want to fill in more plugins to the site just for simple static redirects, I added lines like the following to the < IfModule mod_rewrite.c > section in .htaccess
# END W3TC Browser Cache
# BEGIN W3TC Page Cache core
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=W3TC_ENC:_gzip]
RewriteCond %{HTTP_COOKIE} w3tc_preview [NC]
RewriteRule .* - [E=W3TC_PREVIEW:_preview]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f
RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
# My redirects begin here
Redirect 301 /?page=123 /team/
Redirect 301 /?page=456 /contact/
# ... ect
However when I try
curl -I www.example/?page=123
I get 404 not 301. Also www.example/team/ gives 200.
How can I debug my redirects? Are Redirect 301 in some way affected by the RewriteCond and RewriteRule set that's been added by Wordpress or plugins?
Share Improve this question asked Aug 14, 2019 at 11:57 user6329530user6329530 1651 gold badge1 silver badge6 bronze badges1 Answer
Reset to default 0Please check with this site for 301 or 302 redirections
http://www.redirect-checker/
本文标签: htaccess Redirect 301 doesn39t work How to debug
版权声明:本文标题:htaccess Redirect 301 doesn't work. How to debug? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745242676a2649413.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论