|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
301 redirect index.asp
<%
If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then Response.Status="301 Moved Permanently" Response.AddHeader "Location","http://www." & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("REQUEST_URI") Response.End End if %> This code is working go non www to www but I need another code for index.asp to www for my client site my client using iss server shared server….. Help require I have search complete seo chat but I didn’t get proper answer for this. |
|
#2
|
|||
|
|||
|
Quote:
try isapirewrite.com |
|
#3
|
|||
|
|||
|
Quote:
It’s for server end and I know it read my post I am asking code for source which may directly paste in my root page? |
|
#4
|
||||
|
||||
|
on the server you need to make a new "DEFAULT" page for folders. so for instance you will have a list of the default pages that get priority when you go to a folder:
1. index.asp 2. index.html 3. main.asp etc... If index.asp does not exist the server will try to show index.html and then main.asp and so on. so what you need to do is make the index.asp always redirect to the root of the page and create a default.asp (or something that no one would consider linking to or typing into the browser). What you then need to do is to set this default.asp as the default file for folders like the following: 1. default.asp 2. index.asp 3. main.asp This way whenever someone goest to the root of your website it will show default.asp, but if someone goes to your index.asp page it will redirect to the root. This is how i do it anyway and it works fine. |
|
#5
|
||||
|
||||
|
Quote:
Thanks for the instructions...but how do you redirect index.asp to the root?
__________________
SEO FAQs - You might find your answer here. SEOchat Forum Rules - Read Before You Post **Do what you feel in your heart to be right- for you'll be criticized anyway. You'll be damned if you do, and damned if you don't.** |
|
#6
|
|||
|
|||
|
actually my problem is in my past i solved a canonical problem this website was in php I used
<?php if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') { header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); } if ($_SERVER['REQUEST_URI'] == '/index.php') { header( 'HTTP/1.1 301 Moved Permanently' ); header( 'Location: http://www.myclientwebsite.com/' ); } ?> It works non www to www and index.php to www and I added it in my home page header and I have another client website create in asp I used code for non www to www is <% If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then Response.Status="301 Moved Permanently" Response.AddHeader "Location","http://www." & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("REQUEST_URI") Response.End End if %> but I mann't redirect it for index.asp to www if you have any code for this which is i can directly add then please provide me even I search it from webmaster world and completely seo chat but I did get proper answer for this is our client site using IIS server and it is shared hosted.... |
|
#7
|
|||
|
|||
|
Quote:
Yes same question I would like to ask I need code for this I think many times I asked this question in differ forums in this forum also but people send me some redirect ulr some are webconfs, webmaster world, I have read all the website from more than 3 months but still no solutions. |
|
#8
|
||||
|
||||
|
Quote:
Ok so you have your main template (homepage) on a default.asp, so on the index.asp just put: <% ' Permanent redirection Response.Status = "301 Moved Permanently" Response.AddHeader "Location", "/" Response.End %> This will always redirect the index.asp to the root of the website which has been told to grab the randomed named file which in this instance i called default.asp |
|
#9
|
||||
|
||||
|
And do u know the code that will accomplish this in .NET ?
|
|
#10
|
|||
|
|||
|
you mean to say i have put in my index.asp page
it will work for non www to www and index.asp to www <% If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then Response.Status="301 Moved Permanently" Response.AddHeader "Location","http://www." & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("REQUEST_URI") Response.End End if ' Permanent redirection Response.Status = "301 Moved Permanently" Response.AddHeader "Location", "/" Response.End %> |
|
#11
|
|||
|
|||
|
Quote:
it is for both things or only fro index.asp my dear. |
|
#12
|
||||
|
||||
|
Quote:
Only from /index.asp to root. If you want to redirect non-www to www in IIS, then this is the way I do it. Login to your IIS and create a new website with the host name of domain.com Right click on this website and select properties. Go to the Home Directory tab and check the "A redirection to a URL" Enter the www version of your website in the Redirect to field and add a few suffixes such as http://www.domain.com$S$Q Check "A permanent redirection to this resource" Click ok and all should be set Last edited by pro_seo : August 14th, 2008 at 07:23 AM. |
|
#13
|
||||
|
||||
|
Quote:
afraid not, im still trying to get my head around .net. If i do i will let you know. |
|
#14
|
|||
|