Reply to topic  [ 8 posts ] 
Moving a WordPress blog and redirecting traffic 
Author Message
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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.


Sat Jul 17, 2010 1:57 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 5288
Location: ln -s /London ~
Reply with quote
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?

_________________
timark_uk wrote:
Gay sex is better than no sex

timark_uk wrote:
Edward Armitage is Awesome. Yes, that's right. Awesome with a A.


Sat Jul 17, 2010 3:09 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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/


Sat Jul 17, 2010 3:42 pm
Profile WWW
Moderator
User avatar

Joined: Thu Apr 23, 2009 6:11 pm
Posts: 12143
Location: Belfast
Reply with quote
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

_________________
okenobi wrote:
All I know so far is that Mark, Jimmy Olsen and Peter Parker use Nikon and everybody else seems to use Canon.
ShockWaffle wrote:
Well you obviously. You're a one man vortex of despair.


Sat Jul 17, 2010 3:53 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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


Sat Jul 17, 2010 4:28 pm
Profile WWW
Moderator
User avatar

Joined: Thu Apr 23, 2009 6:11 pm
Posts: 12143
Location: Belfast
Reply with quote
Excellent. Well done. I'll bookmark this thread for future reference. Cheers man.

Mark

_________________
okenobi wrote:
All I know so far is that Mark, Jimmy Olsen and Peter Parker use Nikon and everybody else seems to use Canon.
ShockWaffle wrote:
Well you obviously. You're a one man vortex of despair.


Sat Jul 17, 2010 4:38 pm
Profile WWW
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 11:36 pm
Posts: 3527
Location: Portsmouth
Reply with quote
.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:

_________________
Image


Sun Jul 18, 2010 7:57 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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


Mon Jul 19, 2010 11:25 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.