Posted By

neal_grosskopf on 10/14/08


Tagged

ASP seo


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

neal_grosskopf
wizard04


How To Create A 301 Redirect For Domains Or Home Page Variances


 / Published in: ASP
 

URL: http://www.nealgrosskopf.com/tech/thread.asp?pid=22

Learn how to create a 301 redirect for domain or home variations to improve your websites' search engine optimization.

  1. '301 Redirect - URL Must Contain www.domain.com
  2. CorrectDomain = "www.domain.com"
  3. DefaultPage = "/index.asp"
  4. QueryStrings = request.ServerVariables("QUERY_STRING")
  5. URL = request.ServerVariables("URL")
  6.  
  7. if instr(request.ServerVariables("SERVER_NAME"),CorrectDomain) = 0 then
  8.  
  9. if QueryStrings <> "" then
  10. QueryStrings = "?" &amp; QueryStrings
  11. end if
  12.  
  13. if instr(URL,DefaultPage) then
  14. URL = replace(URL,DefaultPage,"/")
  15. end if
  16.  
  17. response.Status = "301 Moved Permanently"
  18. response.AddHeader "Location","http://" &amp; CorrectDomain &amp; URL &amp; QueryStrings
  19. response.End
  20.  
  21. end if

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: Jacky888 on July 18, 2018

g620 a2 firmware gofirmware

Posted By: iosman on November 12, 2018

Im in love with your content and also gain some knowledge from your blog.

192.168.l.254 ip psiphon ios appvalley download

You need to login to post a comment.