WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > IT Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

IT Discussion Forum Having IT issues? Got IT questions? Who doesn't? If you can't get your Apache to work with your MySQL or your php is choking on your ODBC... Let's see if we can help you come up with some ideas.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-25-2006, 11:25 AM
Gert Leroy's Avatar
WebProWorld Pro
 

Join Date: Oct 2005
Location: Natal - Brasil
Posts: 212
Gert Leroy RepRank 0
Default 301 permanent redirect on IIS: how to do it?

hi,
i asked my hosting-provider to make a 301 permanent redirect from visitnatalbrazil.com to www.visitnatalbrazil.com and this for SEO-purpose.

My hosting-provider says i'm the first one who ask him this..

What is the best way to do this and can he charge me an extra cost for this?
Reply With Quote
  #2 (permalink)  
Old 04-25-2006, 11:31 AM
ADAM Web Design's Avatar
WebProWorld 1,000+ Club
 

Join Date: Dec 2003
Location: Toronto, Ontario, Canada
Posts: 2,217
ADAM Web Design RepRank 0
Default

It's really quite simple.

Your host would merely have to set up visitnatalbrazil.com as a new site and initially point it to the same folder as www.visitnatalbrazil.com .

When they've done that, they need to visit the Properties of the visitnatalbrazil.com site, and click the Home Directory tab. There's an option there to redirect to a URL, which they would pick and type in http://www.visitnatalbrazil.com and check the "A permanent redirection for this resource" box.

That's it.

They can charge you for anything they want, and since this is non-standard they might. I can't say for sure, although it's about a two-minute job in IIS.
Reply With Quote
  #3 (permalink)  
Old 04-25-2006, 12:27 PM
Easywebdev's Avatar
WebProWorld Veteran
 

Join Date: Apr 2004
Location: Donegal, Ireland.
Posts: 322
Easywebdev RepRank 1
Default

You should never need to redirect domain.com to www.domain.com.

If domain.com is not appearing and www.domain.com is then your host has misconfigured your dns settings. Your dns settings should have an A record for both domain.com and www.domain.com

Doing a dnsreport on your site throws up a lot more problems than a missing A record, you need to get your host to sort out their server, nameservers and dns, it is an absolute mess.

http://www.dnsreport.com/tools/dnsre...atalbrazil.com
Reply With Quote
  #4 (permalink)  
Old 04-25-2006, 07:31 PM
ADAM Web Design's Avatar
WebProWorld 1,000+ Club
 

Join Date: Dec 2003
Location: Toronto, Ontario, Canada
Posts: 2,217
ADAM Web Design RepRank 0
Default

He might for SSL reasons.
Reply With Quote
  #5 (permalink)  
Old 04-25-2006, 08:15 PM
Easywebdev's Avatar
WebProWorld Veteran
 

Join Date: Apr 2004
Location: Donegal, Ireland.
Posts: 322
Easywebdev RepRank 1
Default

Quote:
Originally Posted by ADAM Web Design
He might for SSL reasons.
Only in the above misconfigured dns scenario.

A properly configured domain will have A records for both the domain.com and the www.domain.com so even when using a secure cert https://domain.com and https://www.domain.com are exactly the same site and will serve the same security certificate.
Reply With Quote
  #6 (permalink)  
Old 04-26-2006, 12:10 PM
Gert Leroy's Avatar
WebProWorld Pro
 

Join Date: Oct 2005
Location: Natal - Brasil
Posts: 212
Gert Leroy RepRank 0
Default

is there a way to solve this with scripting? that way i don't need my host..

i use ASP.
Reply With Quote
  #7 (permalink)  
Old 04-26-2006, 01:45 PM
ADAM Web Design's Avatar
WebProWorld 1,000+ Club
 

Join Date: Dec 2003
Location: Toronto, Ontario, Canada
Posts: 2,217
ADAM Web Design RepRank 0
Default

Code:
Dim Domain, URL
Domain = Request.ServerVariables ("HTTP_HOST") ' Gets the domain name.
URL = Request.ServerVariables ("URL") ' Gets the current URL.
if InStr (Domain, "www") = 0 then
	URL = "http://www." & Domain & URL ' Concatenates the URL to the domain
	Response.Status = "301 Moved Permanently"
	Response.AddHeader "Location", URL
end if
Response.Write Domain & URL ' You can remove this if you want.  This just adds a check at the end.
That should do it.

Try it here:

http://searchenginefriendlylayouts.com/test_domain.asp (I intentionally removed the www).
Reply With Quote
  #8 (permalink)  
Old 04-26-2006, 04:06 PM
Gert Leroy's Avatar
WebProWorld Pro
 

Join Date: Oct 2005
Location: Natal - Brasil
Posts: 212
Gert Leroy RepRank 0
Default

Hello Adam,

thanks for the script. i implemented it and it gives back the correct server header, without help of my host.

just one remark:
http://visitnatalbrazil.com redirects to http://www.visitnatalbrazil.com/index.asp and not to http://www.visitnatalbrazil.com/
Is this OK regarding the passing through of linkpopularity to http://www.visitnatalbrazil.com/ ?

thanks again for the help.
Reply With Quote
  #9 (permalink)  
Old 11-04-2006, 09:51 PM
Gert Leroy's Avatar
WebProWorld Pro
 

Join Date: Oct 2005
Location: Natal - Brasil
Posts: 212
Gert Leroy RepRank 0
Default

Quote:
Originally Posted by ADAM Web Design
Code:
Dim Domain, URL
Domain = Request.ServerVariables ("HTTP_HOST") ' Gets the domain name.
URL = Request.ServerVariables ("URL") ' Gets the current URL.
if InStr (Domain, "www") = 0 then
URL = "http://www." & Domain & URL ' Concatenates the URL to the domain
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", URL
end if
Response.Write Domain & URL ' You can remove this if you want. This just adds a check at the end.
Can anyone give me exact the same code for PHP?
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > IT Discussion Forum
Tags: , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0