Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

301 direct in asp

Status
Not open for further replies.

tonyx666

MIS
Apr 13, 2006
214
GB
i have a homepage.. it can be reached in several ways..


i also have another couple of domains that redirect to

should i use a 301 redirect on every page except the one that has my pr..

and also is it as simple as pasting this on the page..


<%
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "Response.End
%>

come on the gunners!
 
ok ive seen this example.. i think this is what i want because my page in this form..


has a PR of 2, and the has PR of 0.. so what i want is to redirect the to the address

how tho.. i mean, both of the above urls will load my index.htm page..

where do i put the below code..

maybe there is something i dont know.. is there a page and extension that loads a site with the http.. and one that does not??

anyway. here is the code.. i think i need a bit more explanation please someone

Code:
<%
  ' If the server name is not [URL unfurl="true"]www.sitename.com[/URL] we can do the redirect to [URL unfurl="true"]www.sitename.com.[/URL] 
  ' The only time we can is if the method is a GET
  ' (no way to pass along the POST arguments) and its on port 80 (don't want to redirect the SSL).
if ( strcomp( lcase( Request.ServerVariables("SERVER_NAME") ) , "[URL unfurl="true"]www.sitename.com",[/URL] 1 ) <> 0 _
    AND Request.ServerVariables("SERVER_PORT") = 80 _
    AND strcomp( lcase( Request.ServerVariables("REQUEST_METHOD") ) , "get" , 1 ) = 0 _
) then
    URL = "[URL unfurl="true"]http://www.sitename.com"[/URL] & Request.ServerVariables("SCRIPT_NAME")
    if len ( request.servervariables("QUERY_STRING" ) ) > 0 then
        URL = URL + "?" + request.servervariables("QUERY_STRING" )
    end if
    Response.Status="301 Moved Permanently"
    Response.AddHeader "Location", URL
    Response.End
end if
%>

come on the gunners!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top