FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Move to subdomain without causing 404 errors on old pages?





Animal
I recently discovered that I could add subdomains to my account with my domain registrar. Originally, my Blog was at blog.e-ignite.co.uk but when I messed with my domain's DNS settings, I found that subdomains no longer worked. I then moved my blog to e-ignite.co.uk/blog where it is currently.

I would like to move it back to blog.e-ignite.co.uk (since I can now use subdomains) if it's possible to provide some way that if someone uses an existing link:
e-ignite.co.uk/blog/archives/website/...
to be redirected to:
blog.e-ignite.co.uk/archives/website/...

Perhaps this could be achieved by using something like mod rewrite or .htaccess?

I'm not exactly experienced in using php, so I've got no clue as to how to go about this, or even if it's possible. However, any advice offered would be most appreciated.
wumingsden
Animal wrote:
I recently discovered that I could add subdomains to my account with my domain registrar. Originally, my Blog was at blog.e-ignite.co.uk but when I messed with my domain's DNS settings, I found that subdomains no longer worked. I then moved my blog to e-ignite.co.uk/blog where it is currently.

I would like to move it back to blog.e-ignite.co.uk (since I can now use subdomains) if it's possible to provide some way that if someone uses an existing link:
e-ignite.co.uk/blog/archives/website/...
to be redirected to:
blog.e-ignite.co.uk/archives/website/...

Perhaps this could be achieved by using something like mod rewrite or .htaccess?

I'm not exactly experienced in using php, so I've got no clue as to how to go about this, or even if it's possible. However, any advice offered would be most appreciated.


The following in a .htaccess file might work:

Code:
Redirect http://www.e-ignite.co.uk/blog/archives/website/ http://www.blog.e-ignite.co.uk/archives/website/


The code shouold be all on one line (unless it is too long to fit, of course). I'm not too sure whether the above will work with the "http://www." but try it anyway.

It it doesn't (and if you do not use www.e-ignite.co.uk but e-ignite.co.uk (do not use the www.)) then try the following an a .htaccess file:

Code:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http://example.com/$1 [R=301, L]

Redirect http://e-ignite.co.uk/blog/archives/website/ http://blog.e-ignite.co.uk/archives/website/
Animal
Would I be able to use wildcards in the above, or would I need to create one redirect for every single page on my blog?

Oh, and PS: Thanks for the help so far btw Wink
wumingsden
Animal wrote:
Would I be able to use wildcards in the above, or would I need to create one redirect for every single page on my blog?

Oh, and PS: Thanks for the help so far btw Wink


Hmm, i thought it'll work for all pages because of the ending slash, but now I have my doubts. I'd just test it and see what happens. If it works, great, if it doesn't, delete the file.
swizzy
everybody has been giving you advise on redirecting the pages, in the sense visibly redirecting the pages, so google counts that as a fraud and that means lower ratings!

mod rewriting means converting the url on the fly, and as you notice subdomains are just subfolders on frihost, but still they require a separate .htaccess, i can try though
Related topics
Does anyone know how to get your site to appear higher ?
.htaccess tutorial
Custom error pages using .htaccess
How old is this guy?
Linux - Red Hat
Search RESULTS?
How to write a code which will keep bandwidth to a minimum?
AJAX tutorial [2nd part now updated]
.htaccess -- redirecting an I.P. range
browser redirects 404 errors
5 Awesome Sci-Fi Inventions
how to make old html point to php
How to move SQL database to new domain?
My Blog is Down
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.