301 Redirect for Old/Deleted Post having the Default Permalink using .htaccess (1 post)

  1. Bureau67
    Posted 4 years ago #

    I first installed a WP blog at mydomain.com/blog and published my first post. The post URL is - http://www.mydomain.com/blog/?p=4

    Later I decided to install WP at the root directory of the domain mydomain.com and removed/deleted the /blog/ directory from the server. So, http://www.mydomain.com/blog/ no longer exists.

    The newly installed blog has a post with the URL - http://www.mydomain.com/a-nice-article.html (yes, I set the Permalink structure as /%postname%.html)

    Now I want to 301 Redirect http://www.mydomain.com/blog/?p=4 to http://www.mydomain.com/a-nice-article.html using .htaccess (or otherwise)

    I first tried using the following -
    Redirect 301 /blog/?p=4 http://www.mydomain.com/a-nice-article.html

    But it didn't work. Later I learned from other threads of this forum that it won't work like that. My question is how to achieve this? Any help is appreciated.

    P.S. I tried a lot of redirect plugins but with no success. I can redirect to the root domain URL using a couple of them though. But I want to redirect to that specific page.

Topic Closed

This topic has been closed to new replies.

About this Topic