x404.co.uk
http://www.x404.co.uk/forum/

Moving a WordPress blog and redirecting traffic
http://www.x404.co.uk/forum/viewtopic.php?f=4&t=9532
Page 1 of 1

Author:  forquare1 [ Sat Jul 17, 2010 1:57 pm ]
Post subject:  Moving a WordPress blog and redirecting traffic

Hi all,

I want to move my blog from hashbang0.com/blog to blog.hashbang0.com, I want to do this to make file management a little easier.
I know how to move the blog, that's the easy bit. But how can I do the redirection?

The redirection needs to redirect people visiting the URL hashbang0.com/blog and needs to redirect old links which might point to something like hashbang0.com/blog/2010/06/17/my-blog-post/, so the redirect has to work on subdirectories as well.

If anyone knows how to do this, I'd be very appreciative.

Many thanks,
Ben

EDIT: I'm using DreamHost, not sure if that makes a difference.

Author:  EddArmitage [ Sat Jul 17, 2010 3:09 pm ]
Post subject:  Re: Moving a WordPress blog and redirecting traffic

Could you not set the subdomain to point to hasbang0.com/blog so that old users still use their old url, and new users or users from the rest of your site and all links once a user is there point to blog.hasbang0.com?

Author:  forquare1 [ Sat Jul 17, 2010 3:42 pm ]
Post subject:  Re: Moving a WordPress blog and redirecting traffic

I don't believe I can...Plus I wouldn't reap the benefits of doing this.

I'm using a subdomain mainly to transfer my blog to a different user on the same server. This way all of the files under my main user are maintained by myself, whereas my blog is maintained by WordPress under another user. This means I can simplify some of my scripts that currently have to test to see if a file is attached to a blog and then not touch it.

I've been looking at .htaccess files, but I can't get it to work...I'm currently trying this line:
Code:
Redirect 301 /blog/ http://blog.hashbang0.com


It works for hashbang0.com/blog/, but doesn't work for hashbang0.com/blog/2010/06/17/my-blog-post/

Author:  timark_uk [ Sat Jul 17, 2010 3:53 pm ]
Post subject:  Re: Moving a WordPress blog and redirecting traffic

forquare1 wrote:
so the redirect has to work on subdirectories as well.
Is this actually possible? I'm not sure that your already existing links will redirect if you go from hashbang0.com/blog to blog.hashbang0.com/ … .
I'm not sure there's any way to redirect all your already existing blog links, though I'll be interested to hear if there is.

Mark

Author:  forquare1 [ Sat Jul 17, 2010 4:28 pm ]
Post subject:  Re: Moving a WordPress blog and redirecting traffic

I've done it :D

I was using the wrong line in my htaccess file, I needed this:
Code:
Redirect 301 /blog http://blog.hashbang0.com

Note the lack of a "/" on the end of "blog".

This will carry over the rest of the address, including subdirs.

hashbang0.com redirects to blog.hashbang0.com
hashbang0.com/blog/2010/06/17/my-blog-post/ redirects to blog.hashbang0.com/2010/06/17/my-blog-post/

Which is exactly what I wanted :)

I've disabled it for now as blog.hashbang0.com isn't set up yet :P

Ben

Author:  timark_uk [ Sat Jul 17, 2010 4:38 pm ]
Post subject:  Re: Moving a WordPress blog and redirecting traffic

Excellent. Well done. I'll bookmark this thread for future reference. Cheers man.

Mark

Author:  Nick [ Sun Jul 18, 2010 7:57 pm ]
Post subject:  Re: Moving a WordPress blog and redirecting traffic

.htaccess is amasing stuff, although it gets very complicated very quickly.

I use it on my site for pretty URLs, but I've got wordpress running in a directory, so that needs to be handled differently and there are exceptions for certain file-types like stylesheets and images.

If I ever need to change anything it takes me ages to figure out what it's actually doing currently, and how! :lol:

Author:  forquare1 [ Mon Jul 19, 2010 11:25 am ]
Post subject:  Re: Moving a WordPress blog and redirecting traffic

Nick wrote:
If I ever need to change anything it takes me ages to figure out what it's actually doing currently, and how! :lol:

:lol: :lol:
I'm like that with some of the regular expressions in my scripts

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/