• WPChina

    (@wordpresschina)


    My blog is currently located in the root of my site at https://www.myblog.com but I want to move it to https://www.myblog.com/blog/. I understand how to move it into the new directory and how to reset the links on the blog to show the new directory of /blog/ but I still have a problem:

    How can I setup an htaccess so that anybody coming to the old link in the root at myblog.com/%year%/%monthnum%/%day%/%postname%/ can now go to myblog.com/blog/%year%/%monthnum%/%day%/%postname%/ ?

    Thank you for your guidance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter WPChina

    (@wordpresschina)

    OK, I set this up and it works:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^(.*)$ https://www.myblog.com/blog/$1 [R=301L]]
    </IfModule>

    However, I still have one very important problem to work out. Now that the old blog links are pointing to the new blog links, I also want to do something unorthodox. I have another directory that I want to make the main section of my entire website, and it currently resides at https://www.myblog.com/gallery

    I want to make people coming to https://www.myblog.com to instead be forced to go to https://www.myblog.com/gallery.

    So do you follow me on all this? I want to do 2 things, and the first thing is already working:
    1) point myblog.com/%year%/%monthnum%/%day%/%postname%/ to myblog.com/blog/%year%/%monthnum%/%day%/%postname%/
    2) If anybody goes directly to https://www.myblog.com (the old homepage of the entire site), they will instead go to https://www.myblog.com/gallery/

    For the second idea above, I tried this code:

    Redirect 301 /index.php https://www.myblog.com/gallery/

    If I use that ALONE (without the RewriteRule code I mentioned at the very beginning), it works fine. However when I use the code for #1 and #2, only the #1 code works and the #2 code doesn’t work at all…

    Any ideas?

    Thread Starter WPChina

    (@wordpresschina)

    Sorry to bounce, but this is a headache to figure out. I’m sure it’s a matter of 1-2 lines of code in htaccess, but the more I ply around with it, the more combinations I find that continue to ruffle my feathers.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to set htaccess correctly when I move my blog to new directory?’ is closed to new replies.