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 %{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.com/?page=123

I get 404 not 301. Also www.example.com/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?

1 Answer 1


Please check with this site for 301 or 302 redirections


  • Uhm... That gives me literally the exact same result as curl -I (in fact the site IS internally probably just using curl). That's not an answer to my question. The site reports 404, same as I already wrote. Aug 14, 2019 at 12:11
  • Please specify the team url like /?page=123 Redirect 301 /?page=123 /?page=125 Aug 14, 2019 at 12:16
  • What does that mean? Aug 14, 2019 at 12:18
  • We can set a permalink structure at a time. (In the Settings->Permalinks). So the whole page urls will be treated with this fomat. In your code, 2 types are specified Aug 14, 2019 at 12:20
  • The permalink structure is not the issue here. I need to redirect OLD URLs that don't exist in the NEW wordpress to the NEW slugs Aug 14, 2019 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.