• moshu

    (@moshu)


    I used to have a WP install at mydomain.com/wp.
    The blog has been moved to subdomain.mydomain.com/blog.

    There are quite a number of incoming links to the old address. Is there any possibility to set up some .htaccess magic to redirect those links to the new location?
    The blog is using the same permalink structure in both places:
    archives/year/month/day/post-title

    Any .htaccess guru out there? Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • jwilliams

    (@jwilliams)

    an easy solution might to delete the ./wp directory, and then

    $ ln -sf ./blog wp;

    then you have a blog dir and a filesystem link wp to ./blog,
    so when apache calls wp it gets stuff out of ./blog.

    Thread Starter moshu

    (@moshu)

    Thanks, but I am afraid you will have to be more explicit – consider me totally illiterate in this matter.
    And just in case you missed:
    old address – mydomain.com/wp
    new address – subdomain.mydomain.com/blog

    jwilliams

    (@jwilliams)

    Ah, yes, I didn’t notice the subdomain part. I’ll get back later.

    Thread Starter moshu

    (@moshu)

    Thanks, jwilliams.
    Maybe in the meantime somebody can give me some detailed instructions 🙂

    jwilliams

    (@jwilliams)

    what is the absolute local path to your document root for domain.com,
    and what is the absolute local path to your document root for subdomain.domain.com ?

    niziol

    (@niziol)

    Moshu,

    I use this redirect rule in my .htaccess, it would redirect any request for the old address to the new. I don’t use it with a sub domain, but I have used a similar rule in the past to completely different domains and it worked well:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp/(.*)$ http://sub.example.com/$1 [R=301,L]

    Just add all of that (or just the rule on the last line) to your .htaccess and give it ago. The above assumes the .htaccess will be in the root www directory. I’m not sure if it’s the best or not, but it works for me!

    Good luck,
    Michael.

    Thread Starter moshu

    (@moshu)

    /home/**myusername**/public_html/
    and
    /home/**myusername**/public_html/subdomain/

    niziol

    (@niziol)

    This should do it for you then moshu:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp/(.*)$ /*subdomain*/$1 [R=301,L]

    Just change the *subdomain* to your intended subdomain and place the code (either all of it or the rewrite rule) into the .htaccess in your root (/home/*username*/public_html) directory or adjust the paths accordingly.

    Cheers,
    Michael.

    Thread Starter moshu

    (@moshu)

    Thanks, Michael, I’ll give it a try.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘.htaccess (?) redirect help needed for moved WP install’ is closed to new replies.