Redirection

January 30, 2004 | View Comments (17) | Category: Web Mastering

Summary: Redirecting people to the new Vault domain.

I have had a couple of offers from some great people on hosting CSSVault so hopefully this weekend all the details can be worked out. Now the problem goes to redirecting people from the current site to the new domain. I see using PHP redirects and htaccess redirects as obvious options I guess, but would there be a better way. Also, any ideas on how to get the majority of sites that link to the vault to change or is this not reasonable at all? With regards to .htaccess redirects, does anyone have some pointers as to the specific code I could use?

For all the people who have given me offers, I can't thank you enough.

Trackback URL: http://9rules.com/cgi-bin/mt/mt-tb.cgi/131

Comments

#1

*applause at those who offered to help* (^_^)// Thanks a lot.

Zelnox

#2

redirectpermanent /cssvault http://www.cssvault.com

but that won't keep people's links good.

Maybe something with mod_rewrite?

I know you can do it in PHP by using parseurl() to parse out the address they're trying to reach and rewriting the host variable before using header location for the (permanent) redirect

JC (http://thelionsweb.com/weblog)

#3

yes...

Redirect / http://yournewsite.com/

you may be able to swap "/" with some form of wildcard.

see this tutorial:
Comprehensive guide to .htaccess - Redirects

Nick (http://www.digital-web.com)

#4

Don't move the entire site - just the thumbnails.

Mark Fusco (http://www.lightpierce.com/ltshdw)

#5

Since the directory structure is bound to be similar (everything minus the /cssvault directory, I assume), it should be very easy to automatically redirect things. I'm about to move Passive Digressive to a real host (as opposed to my Mac at home), and that's what I plan to do.

Glad everything is being worked out. Whoever the new host is, big thanks!

Chris Vincent (http://dris.dyndns.org:8080/)

#6

Hmm, I remember some http error code that states that a document has been moved; 301 Moved Permanently. But I don't know how the browsers will cope. Will it pick up the url and redirect automaticly, or just show it as an error or maybe even a third option.

So I put up an test page, http://mantaworks.nl/test/error/ . It has an index.php file with two lines:

header("HTTP/1.0 301 Moved Permanently");
header("Location: http://www.php.net/");
?>

Tested in win/firebird 0.7 and win/IE6 and both show the same result: an external redirect. A .htaccess file with a redirect maybe a safer option, but I'm not too happy with tinkering the server. If something goes bad, it goes baaad.

But one fact remains: the user doesn't get any info that the link isn't valid anymore, only a change in the url field of the browser is present. A little check on the new domain for the referer and throwing up some kind of warning would solve that.

[m] (http://mantaworks.nl)

#7

Forget what I said about that url field changing in IE6. Sheesh.

[m] (http://mantaworks.nl)

#8

I'm with Mark Fusco on this, only move the images. It's a lot less work and the result would be the same.

Bart N. (http://percept.be)

#9

messing with an htaccess file isn't a big deal usually. just delete it. It's not like http.conf where a typo can hose the whole webserver til you fix it.

Just don't redirect 404 errors to a page that doesn't exist. Been there, done that, took down the machine.

Not sure on the images. Sounds like a good move, but it's more work for you to put one on one place and one on another place. Also, moving the whole thing to a new server futureproofs it. If everthing's on cssvault.com or whatever, you can move everything to a dedicated server when you need to, with no fuss and no having to go in and edit all those pages.

Plus you can get double spam! whatever@9rules AND whatever@cssvault. How can you pass that up? :-)

JC (http://thelionsweb.com/weblog)

#10

I would say: "As Mark said, move just the thumbnails. Why not? Simple and fast..."

But what about the the actual mt configuration and entries? Even if mt has a good export/import system with the same effort you'll move the entire CSSVault.

JTG Mark (http://jumpthegap.com/)

#11

I'd say the .htaccess is the easiest way, and shouldn't give you any trouble. As long as you use a permenant redirect, some browsers will even update their own bookmarks. Even without the update, it'll be seamless for everyone.

You could also code the page to detect if you had just been redirected. It could trigger a short, highlighted notice to let visitors know, without actually disrupting their task.

Justin (http://bluealpha.com)

#12

Don't over-complicate things - steer clear of PHP redirects. If you're on shared hosting with Apache you really don't want/need the additional overhead. Using PHP will mean that apache still has to process the request, create an instance of PHP, parse and run the PHP script, and then remove the resources used. Thats some overhead when a simple .htaccess file with the lines:
RewriteEngine on
RewriteBase /cssvault
RewriteRule ^/$ http://yournewsite.com/ [R=301,L]

will do everything for you, and with a lot less overhead. Using the R=301 will send a "Moved Permanently" header, so future hits will jump directly to your new host.

Dysfunksional.Monkey (http://dysfunksion.co.uk)

#13

Monkey, will that rewrite rule make all links keep working, or just links to /cssvault?

So if someone linked to
/cssvault/gallery/caffeine_overdrive.php
would it take them to cssvault.com/gallery/caffeine_overdrive.php or just to cssvault.com?

I really should pick up some mod_rewrite stuff someday.

JC (http://thelionsweb.com/weblog)

#14

Here's a solution that should work. It would allow you to just move the whole directory structure in its entirety to a new server. Put the following into an .htaccess file in the "/cssvault" directory:

RewriteEngine On

#Rewrite rules
RewriteBase /cssvault # sets the base directory for all following rewrite rules
RewriteRule ^(.*)$ http://www.yournewdomain.com/$1 # Redirects any requests to the new domain, appending any further path information to the path at the new server

Travis Cripps (http://www.apparentmotion.com)

#15

Ooops! Comments and directives on the same line don't mix! Sorry. In light of that...

RewriteEngine On

# Rewrite rules
# Sets the base directory for all following rewrite rules
RewriteBase /cssvault

# Redirects any requests to the new domain, appending any further path information to the path at the new server
RewriteRule ^(.*)$ http://www.yournewdomain.com/$1

Travis Cripps (http://www.apparentmotion.com)

#16

It depends if you want transparent (PHP header() or Apache .htaccess), or nagging (remind people that the location has changed, and to update, using a link page or refresh).

You could also consider emailing webmaster@ advising them of the change in bulk, or automatically once via PHP.

Justin French

#17

Anything after /cssvault/* will be bounced to cssvault.com/*. Sending the 301 header ensures that your user's browsers will remember for next time.

Also, did you know that www. is deprecated?

Pop the following in to an .htaccess file in your root directory to become "Class B" compliant:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.9rules\.com$ [NC]
RewriteRule ^(.*)$ http://9rules.com/$1 [R=301,L]

Don't worry, it won't hurt a bit, and (hopefully) nothing will break.

dysfunksional.monkey (http://dysfunksion.co.uk)

Keep track of comments to all entries with the Comments Feed