Forum Moderators: open

Message Too Old, No Replies

301 Redirect Help!

Which redirect is this?

         

wirral

10:40 am on Mar 10, 2006 (gmt 0)

10+ Year Member



I'm sorry if this is a stupid question, but a client of mine has two domains, and would like 2nd domain to point to the 1st website via a 301 redirect.

I have redirected sites using frames before (which is probably what they don't want), so what redirect is the 301 one?

Enlightenment on this would be greatly appreciated!

JAB Creations

1:54 pm on Mar 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi wirral,

There are two ways this could be handled. If you just want to redirect one domain to another I'm sure who you registered the first domain may have some service...but that will probally cost extra money though I've never tried this myself.

Second is via your web server software. You probally have Apache though there are a few others out there with various methods. In that case I know a basic redirect code for a single page...

.htaccess

Redirect permanent /index.html http://www.example.com

If your server is running Apache then you'll want to ask this question over at the Apache forum...
[webmasterworld.com...]

Hope the direction helps...

John

Kufu

11:16 pm on Mar 10, 2006 (gmt 0)

10+ Year Member



Just a little clarification on JAB Creations recommendation:

The domain being redirected will need to be hosted somewhere. If you'll be hosting it on an Apache server then as JAB Creations said the 301 redirect is rather simple:

1. Create a file called .htaccess
Note: you may have to call it something.htaccess and then change the name once you upload it to the server if Windows doesnt allow you to create a file starting with '.'

2. In the file type the following:

Redirect 301 / [newdomain.com...]

You generally dont want to put /index.html

JAB Creations

4:37 am on Mar 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Kufu ... if wirral can not create .htaccess but does not want to rename the file everytime they upload...they can still download ".htaccess" to Windows and then edit eternally after. Creating the file is the problem...oddly enough.

Thanks for the clarification...didn't know you could direct a whole domain so easily! :)

John

Kufu

4:54 pm on Mar 11, 2006 (gmt 0)

10+ Year Member



JAB,

Yeah it's odd, the only time you need to actually name the .htaccess differently is when you create it; thereafter you can download and upload it without any problems.

As far as redirecting the entire domain goes it is a bit trickier. I am not a 100% certain, but I think if you want to redirect from every existing old page to its equivalent new page on the new domain, then you may need to use mod rewrite, which I am still struggling to wrap my brain around. Hopefully someone else will be able to clarify this.

rainborick

3:23 am on Mar 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You just need to use a variation of the redirect code used to take care of the Dreaded Missing www. problem.

Something along the lines of:


RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?baddomainname.com$
RewriteRule ^(.*)$ http://www.gooddomainname.com/$1 [R=301]

should do the trick.