Create a PHP header redirect...
PHP: PHP Header 301 Redirect - Moved Permanently
Hi Everyone I have a doubt and want a sloution to that
Suppose I have Site with URL
ww.example.com
www.example.co.uk
example.co.uk
example.co.uk/index.php like this all these sites are linked to only single url called i.e www.example.com,
all i need to use a .htaccess for 301 redirect but my server is based on windows so what to do?
Thanks In Advance
Sandeep
_____________________________________
Experts
Create a PHP header redirect...
PHP: PHP Header 301 Redirect - Moved Permanently
Hi,
For a windows server (IIS) do the next:
a. In internet services manager, right click on the file or folder you wish to redirect.
b. Select "a redirection to a URL"
c. Enter the redirection page.
d. Check "The exact url entered above", and the "A permanent redirection for this resource".
e. Click "Apply".
That's it...
Good luck![]()
James G. Evans - SEO Consultant - Learn SEO, online, at your office, anywhere! from £50/hour. Expect the best! Get exclusive access to my know-how! Learn SEO Now, limited availability.
Theres 301 redirect scripts for IIS too you know dude. just do a search on google for asp 301 redirect lolz
Just dug out the one I use. basically it checks to see if your not the real address and does a 301 to the real domain, this way it works on sites where you have multiple domains pointed at one lot of space!
<%
Dim basedomain 'the real domain that users should be redirected to permanently
basedomain = "www.yoursite.co.uk" 'do not include the http:// prefix here, if no www is specified in the URL, just specify the domain...
if( InStr(lcase(request.servervariables("HTTP_HOST")), basedomain) = 0) then
Dim currentFullPath
currentFullPath = "http://" & request.servervariables("HTTP_HOST") & Request.ServerVariables("script_name") & "?" & Request.Querystring
Dim newFullPath
newFullPath = replace(currentFullPath, request.servervariables("HTTP_HOST"), baseDomain)
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location",newFullPath
'Response.Write("<H1>NEW: " & newFullPath & "</H1>")
'Response.Write("<H1>FULL: " & currentFullPath & "</H1>")
end if
%>
Or now you could use the "rel = canonical" tag of course, which is obviously going to fix everything, ROFL
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks