|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Search Engine Optimization Forum SEO is much easier with help from peers and experts! The WebProWorld SEO forum is for the discussion and exploration of various search engine optimization topics. Any non (engine) specific SEO or SEM topics should go here. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello,
I'm looking to use the http://www.mysite.com as the authority URL. I'm running on a shared windows server and have to use code rather than IIS itself to do the 301 redirect. I've a few questions I hope you can help me with. Firstly, should I have a 301 redirect for http://mysite.com, http://www.mysite.com/index.aspx and http://www.mysite.com/ that go to http://www.mysite.com Should I have a 301 redirect on every page? or just the homepage. So for example if someone typed in http://mysite.com/foldername/page1.aspx should that redirect to http://www.mysite.com/foldername/page1.aspx Thirdly, I found some code that redirects http://mysite.com to http://www.mysite.com/index.aspx, but surely that isn't solving the issue and is just the same as having both http://www.mysite.com and http://mysite.com thanks. GBBB. |
|
|||
|
Quote:
Quote:
and this solve your second problem automatically
__________________
Powerful emailmarketing platform newsletters, nieuwsbrief. Responsible for registration and activation of 0800 and 0900 numbers. |
|
|||
|
ok, but conclusion is that you must redirect all url's whithout www for example http://mysite.com/foldername/page1.aspx => http://www.mysite.com/foldername/page1.aspx
otherwise you have the same content for two different url's (duplicate content). about asp, sorry I can't help you - I can show you how do this in php.
__________________
Powerful emailmarketing platform newsletters, nieuwsbrief. Responsible for registration and activation of 0800 and 0900 numbers. |
|
|||
|
IncredibleHelp they don't offer 301 redirects.
They recommended using code like private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www.mysite.com/newpage"); } But I just wondered if this code is more applicable where a single page has been changed. For instance if someone links to a page(s) on my site like http://mysite.com/test.aspx I'd like it to go to http://www.mysite.com/test.aspx so that both versions aren't indexed by Google as separate pages. thanks. |
|
|||
|
I have found something like that :
Code:
<% ' If the server name is not www.sitename.com we can do the redirect to www.sitename.com. ' 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") ) , "www.sitename.com", 1 ) <> 0 _ AND Request.ServerVariables("SERVER_PORT") = 80 _ AND strcomp( lcase( Request.ServerVariables("REQUEST_METHOD") ) , "get" , 1 ) = 0 _ ) then URL = "http://www.sitename.com" & 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 %>
__________________
Powerful emailmarketing platform newsletters, nieuwsbrief. Responsible for registration and activation of 0800 and 0900 numbers. |
|
|||
|
First pl read this url > http://www.beyondink.com/howtos/301-redirect.html
here you can find >>>>>>>>> Microsoft IIS Web Server Note: these instructions require administrative access to IIS. If you do not have this access (e.g., if you have a shared hosting account on a Windows server), you should use one of the server-side scripting methods such as ASP or PHP given further below. Single Page Redirect: 1. Open Internet Services Manager and right-click on the file or folder you wish to redirect. 2. Select the radio button "a redirection to a URL". 3. Enter the desitnation page for the redirect. 4. Check "The exact url entered above" and the "A permanent redirection for this resource". 5. Hit "Apply". >>>>>>>>> you can try with this redirection code >>>>>>>>> Active Server Pages (ASP) Single Page Redirect: <% Response.Status="301 Moved Permanently" Response.AddHeader='Location','http://www.new-url.com/' %> One more thing you can solve the canonical issue with the help of google webmaster tool, there you can choose a domain (with www, or without www ) hope this will help you......... |
|
|||
|
or you can try with this code - write it in a asp.net page >>
ASP .NET Redirect <script runat="server"> private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www.new-url.com"); } </script> |
|
|||
|
This is the asp code i use, i place it at the top of each asp page.
Code:
<%@ Language=VBScript %>
<%
Dim sHttps, sURL, sPath, sQuery, sAddr
sHttps = Request.ServerVariables("HTTPS")
sURL = Request.ServerVariables("HTTP_HOST")
sPath = Request.ServerVariables("PATH_INFO")
sQuery = Request.ServerVariables("QUERY_STRING")
if (sHttps <> "on") then
sHttps = "http://"
else
sHttps = "https://"
end if
if (sPath = "/flash.asp") then
sPath = "/"
end if
if (sQuery <> "") then
sQuery = "?" & sQuery
sPath = sPath & sQuery
end if
sAddr = sHttps & sURL
if (sAddr <> "https://www.covingtonscyclecity.com") then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "https://www.covingtonscyclecity.com" & sPath
end if
%>
it also adds the path and query string to the address. My default pages are named "flash.asp" and are hidden so my default pages show up as: "https://www.covingtonscyclecity.com/" instead of: "https://www.covingtonscyclecity.com/flash.asp" |
|
|||
|
incrediblehelp - you are right if he has not access it not work. then he can try
ASP .NET Redirect <script runat="server"> private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www.new-url.com"); } </script> or "covingtonscustoms" has some idea. But there is no comment from "GBBB" |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |