Forums

[resolved] Setting up a redirect (5 posts)

  1. aliferste
    Member
    Posted 5 years ago #

    Hiya,

    I am trying to set up a redirect from my blog which is at

    http://www.mysite.co.uk/blog

    to my new blog (I have transferred all my old content over)at

    http://www.anothersite.com

    Now, I still have content at http://www.mysite.co.uk which must stay intact so it is just the blog part that must be redirected. This means I cannot just put a simple redirect of the old domain to the new domain in place.
    I have been reading about 301 redirects, so created an .htaccess file with

    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{http_host} ^mysite.co.uk/blog [nc]
    rewriterule ^(.*)$ http://www.anothersite.com/$1 [r=301,nc]

    and put it in the directory where my wordpress installation is.....the reason I am here is because obviously I have done something wrong as it....er...doesnt work !

    Any advice would be great :)

    Alistair

  2. Otto
    Tech Ninja
    Posted 5 years ago #

    You're overcomplicating it. I did the same when thinking about it. :)

    If these are two different servers, then it's trivial.

    RewriteBase /blog/
    RewriteRule ^(.*)$ http://www.anothersite.com/$1 [R=301,L]

    Put this in the /blog/.htaccess file on mysite.co.uk. Done and done. Only stuff in /blog will get redirected.

  3. aliferste
    Member
    Posted 5 years ago #

    Nope, I put the

    The site I am trying to redirect is

    http://www.theriverkelvin.co.uk/blog/

    to

    http://urbanflyfisher.com/

    I put the .htaccess file file in both the blog directory and the root directory but it does not seem to work.

    Any other ideas ?

  4. Otto
    Tech Ninja
    Posted 5 years ago #

    This definitely won't be in the root directory, just in the blog directory's .htaccess file.

    RewriteBase /blog/
    RewriteRule ^(.*)$ http://urbanflyfisher.com/$1 [R=301,L]

    And if doesn't work, you have a broken host. Talk to them. It *does* work, as I use something extremely similar for other purposes.

    The RewriteBase /blog/ bit is technically unnecessary, BTW. You can remove it if you want. I usually leave it so I know what's what, but still, it's not strictly important.

  5. aliferste
    Member
    Posted 5 years ago #

    Great thanks for that :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags