Apologies, for the very long title.

I'd really appreciate any help that anyone can offer with a situation I have currently before I go for the plugin option.

About a month ago I moved my site from:

http to https

I did the move myself and all went well.

Last night I decided to update the Permalink Structure from:




This switch went well and the site is running perfectly.

Now what I need to address is all the old URLs indexed in Google.

I have this .htaccess file on the .com version of my site:

RewriteEngine On 
RewriteCond %{HTTPS} !=on 
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

# 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]
# END WordPress

And I'm wondering if there is a modification that could be made to the above to permanently redirect the indexed URLs to there corresponding post on the new blog.

Indexed URLs such as:


are returning a 404.

Any help would be really appreciated.


2 Answers 2


Since your new URLs do not have any category/ in them, you can redirect every URL that contains this and follows a pattern to your new permalink structure.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^category/(.+)$ https://www.example.com/$1 [R=301,L]

Change example.com to your new website's domain. You can also tweak with the 301 status if you wish.

Now, this


will be redirected to


You can also add the entire URL to the rewrite rule, but since your new domain does not have /category/, It might be safe to redirect every link, unless you decide to create a post that its slug is category!

  • Thanks for the responses and solutions. I have been giving this a lot of thought today and wondered if my initial approach and the basis of this question was wrong. Currently the .htaccess file of the newsite.com redirects the domain to https:. The .htaccess file on the oldsite.net redirects all the links pointing to that site to the corresponding page on newsite.com. Im wondering if a better approach would be to code the .htaccess file of the Oldsite removing the Category at that level given that Wordpress seems to be handling the links to the new site. Commented Jul 3, 2017 at 20:39

I think you need this htaccess rule to redirect any http to https :

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

Changing the example.com to your domain, of course.

  • But the 3rd line of his .htaccess file already redirects every request to the SSL version. The problem is that he changed the permalink structure, which takes months to be updated by google.
    – Johansson
    Commented Jul 3, 2017 at 3:23
  • 1
    Whoops...you're right; missed the third line of his original htaccess. Thanks for the catch. Commented Jul 3, 2017 at 3:25

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.