thatelvis
asked on
301 redirect of an html page
hello,
can I use the following 301 on top of a .html page to give it a good 301 redirect. Pleae note that the site contained some old html pages that are no longer there. I want to do a redirect and am on shared hosting.
I can do a js redir but that only give google a 200 error not a 301. is it poss to add the code below to a html page.
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.mysite.com/index.asp"
%>
regards
k
can I use the following 301 on top of a .html page to give it a good 301 redirect. Pleae note that the site contained some old html pages that are no longer there. I want to do a redirect and am on shared hosting.
I can do a js redir but that only give google a 200 error not a 301. is it poss to add the code below to a html page.
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.mysite.com/index.asp"
%>
regards
k
You can do this in IIS very easily, or via the Web.config.
The web.config trick might only work with IIS7, you'll have to try it.
This will work at the folder level, but not so much the file level.
The web.config trick might only work with IIS7, you'll have to try it.
This will work at the folder level, but not so much the file level.
<system.webServer>
<httpRedirect enabled="true" destination="http://theworld.com/whatever$S$Q" exactDestination="true" httpResponseStatus="Permanent" />
</system.webServer>
ASKER
thank you, i am on a shared windows server at crystaltech. I dont know what to do with the above code (where would i stick it (don't be rude lol))
k
k
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello Ahmad
brilliant concept "So if you have a file called mystuff.html and you want it to execute ASPX or go somewhere else via 302. Create a folder called "mystuff.html" (exact spelling), then create a Default.aspx or Index.aspx and put your redirection code inside that ASPX file."
how seo is it
regarsd
k
brilliant concept "So if you have a file called mystuff.html and you want it to execute ASPX or go somewhere else via 302. Create a folder called "mystuff.html" (exact spelling), then create a Default.aspx or Index.aspx and put your redirection code inside that ASPX file."
how seo is it
regarsd
k
That's a good question. It all depends on how you link to it and how smart the search engine is.
I don't think you need to worry because if
http://www.mysite.com/mystuff.html
is a folder, the request is accepted and they are transferred to
http://www.mysite.com/mystuff.html/
Which shouldn't disturb the request. As long as you don't start linking to the default page:
http://www.mysite.com/mystuff.html/Default.aspx
I don't think you need to worry because if
http://www.mysite.com/mystuff.html
is a folder, the request is accepted and they are transferred to
http://www.mysite.com/mystuff.html/
Which shouldn't disturb the request. As long as you don't start linking to the default page:
http://www.mysite.com/mystuff.html/Default.aspx
ASKER
thank you very much. happy new year
200 is NOT an error code. It means the server found the file and sent it successfully.
>>can I use the following 301 on top of a .html page
If the file is infact named ".html" page then no. What you posted is ASP script and needs to be executed dynamically. That means that you would need to rename that file FROM filename.html TO filename.asp
BUT your new problem is that now browsers/bookmarks will still point to "filename.html" which now does not exist and they will get a 404 error.
>>. I want to do a redirect and am on shared hosting.
Ask your hosting provider if they have some provision that will allow you to redirect (like mod_rewrite).