View Full Version : little help about 301 redirection
burhankhan
10-20-2004, 05:12 AM
Hi:
I search many topics about 301 redirection. And thay all provide me a code.
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently" Response.AddHeader "Location", "www.mysite.com/pages/page23.asp?id=2&p=2"
%>
But i am very confuse, where to put that code? Is i need any special file to write this code? or i need to put in each file of the web?
Thanks
Burhan
seomike
10-20-2004, 04:42 PM
You put this into an .asp page if you have changed its name to a new file name.
When you change header information it has to be the very first lines of code in the page otherwise it won't work.
Also here is the .php equivalent just incase you are on apache.
<?
header("Location: http://www.mysite.com/pages/page23.asp?id=2&p=2");
header("HTTP/1.1 301 Moved Permanently");
?>
Now if you are on apache and have access to the .htaccess file then you won't need to add any code to your pages. If you file names have changed just add a rule for each of the changed files
redirect 301 /oldfile.htm http://www.domain.com/newfile.htm
critter
10-20-2004, 05:41 PM
redirect 301 /oldfile.htm http://www.domain.com/newfile.htmIf you wanted to re-direct your custom 404, would you modify your htacess like so
redirect 301 /404.html http://www.domain.com/newfile.htm
THanks
CRITTER
burhankhan
10-21-2004, 05:07 PM
Thanks for your reply
i have a website which does not have more then 100 pages. And these pages are fully dynamic and each page is full of function.
i want to use this 301 techinque to rank my website in search engine. But i am some confusion.
Let i apply 301 technique in my website. Now my dynamic website is static for search engine. But now, can search engine see my optimized code in pages? Because pages are written in ASP and each page contains many functions.
Will search engine excute my ASP page? and then see the resultent HTML code for ranking?
Or what search engine will do?
Is this technique is usefull for 100 pages website?
Is here any other usefull technique?
Thanks
Burhan
Mikkel deMib Svendsen
10-21-2004, 06:54 PM
I think you may be mixing up techniques :)
301 is a redirect - a permanent redirect. That, in itself, won't do you any good in terms of SEO. In fatc, if you can avoid redirects all together you are usually better off.
Are you thinking of the 404 trick?
burhankhan
10-22-2004, 07:26 AM
May be.
Actually i want:
My dynamic website with dynamic url is look like this:
http://www.mysite.com/pages.asp?id=2&pid=394&cid=928
This url is not recommended by SEO. So i need Static url, like:
http://www.mysite.com/this_is_product_name.html
Then i submit this static url in search engine. Now if user open this static url then my original dynamic url ( http://www.mysite.com/pages.asp?id=2&pid=394&cid=928) should be open.
I don't want to create seperate static html files and then redirect it to dynamic site using javascript. I think it is not good way.
I hope now you clear what i need.
Now tell me in which technique (301 / 404 or some other) it will be suitable?
Thanks
Burhan