Forum Moderators: open

Message Too Old, No Replies

Safely forwarding domain.com to www.domain.com

ASP site running on IIS, redirect (301?) domain.com to www.domain.com

         

fitzer

3:09 pm on Mar 1, 2006 (gmt 0)

10+ Year Member



Can anyone explain to me how to safely (from an SEO perspective) forward/redirect requests for page(s) on [domain.com...] to [domain.com?...] For example:

[domain.com...] -> [domain.com...]

[domain.com...] -> [domain.com...]

[domain.com...] -> [domain.com...]

etc.

I could do this at the top of every ASP page (checking the SERVER_NAME servervariable and 301 redirecting to include www.) but I'm sure there's a more efficient way to do this.

Is this something that can be safely done from the DNS level?

Or is this something that can/should be done within IIS?

Is an isapi rewrite required?

Keep in mind that my main concern is from an SEO perspective - I don't want search engines to see www.domain.com and domain.com as two different sites with duplicate content.

I've come across some other posts related to this issue but none specifically addressing www.domain.com vs domain.com, ex:

[webmasterworld.com...]
[webmasterworld.com...]

Any help would be greatly appreciated : )

webdoctor

4:32 pm on Mar 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is this something that can be safely done from the DNS level?

Not really - you need a web server set up and listening on the ip address example.com which can return a '301 Moved' status code for each http request.

Or is this something that can/should be done within IIS?

It doesn't have to be IIS :-) For instance, if you had a linux server (could even be in a different location) you could configure example.com to point to it, but set up Apache w/ mod_rewrite to send the appropriate '301 Moved' reply for all http://example.com/<foo>.aspx requests - and send people to your IIS server which is configured on www.example.com

Keep in mind that my main concern is from an SEO perspective - I don't want search engines to see www.domain.com and domain.com as two different sites with duplicate content.

You should not be returning any content from example.com other than 301 Moved status codes. Only serve content from www.example.com.

You can check this with wget if necessary.

fitzer

3:17 am on Mar 3, 2006 (gmt 0)

10+ Year Member



...you could configure example.com to point to it, but set up Apache w/ mod_rewrite to send the appropriate '301 Moved' reply for all http://example.com/<foo>.aspx requests...

Great help, thanks. Now I at least understand how to handle this in an Apache environtment; unfortunately (for reasons beyond my control), I'm stuck with a Windows server running IIS for these domains/sites. I'm just not clear how to use IIS to return a "301 Moved status" response for redirects/forwarding or how to be sure this is the response I'm getting.

You can check this with wget if necessary.

Could you elaborate on this? This is all new to me.

thx :)

webdoctor

5:03 am on Mar 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm stuck with a Windows server running IIS for these domains/sites

I realise there may be a 'political' angle to the Apache/Windows arguments in some shops, but my point was that you could use an Apache server purely for the mod_rewrite flexibility and ONLY to do the redirects from example.com/foo.aspx -> www.example.com/foo.aspx. You will continue to use Windows/IIS for your site.

how to use IIS to return a "301 Moved status" response for redirects/forwarding

Have a look at ISAPI_Rewrite

You can check this with wget if necessary.

Could you elaborate on this? This is all new to me.

Grab a copy of wget for windows (Google for it - "Heiko Herold's" is an easy place to find it).

Try wget <url> and see what you get. For instance,wget [microsoft.com...] will give you a 302 Moved redirect from microsoft.com to www.microsoft.com

rebelde

5:19 am on Mar 3, 2006 (gmt 0)

10+ Year Member



301 your entire website from domain.com to www.domain.com?

It's not too bad once you finally find the answer...

Create a second web site in IIS responding to a different IP address.
In IIS>"Home Directory":
Check "Redirection to a URL"
Redirect to: [domain.com$S$Q...]
Then check: "exact URL entered" and "A permanent redirection for this resource"

Get the DNS set up right.

Now ALL pages will be forwarded such as:
[domain.com...] -> [domain.com...]

There are some more thorough tutorials out there on the web, and the IIS "Redirect Reference" explains things like the $S$Q.

fitzer

9:32 pm on Mar 6, 2006 (gmt 0)

10+ Year Member



Thanks rebelde. I'll post again once I've implemented this solution.

I came across this from Matt Cutts. Related and helpful:
SEO advice: url canonicalization [mattcutts.com]