Welcome to WebmasterWorld Guest from 54.146.221.231

Message Too Old, No Replies

Redirection 301 - On URL or on file?

     
7:05 am on Nov 3, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 2, 2002
posts:120
votes: 0


Hi,
Can somebody advice that a 301 rediction can be implemented to a complete file or I can have it on various URLs with the same file name but different query string.

Like

I have a file

mydomain.com/index.asp?id=1
mydomain.com/index.asp?id=2

Now I want to put 301 redirection on this site and want to take mydomain.com/index.asp?id=1 to a different file and mydomain.com/index.asp?id=2 a different file..Is it possible? Or I can just have this on a complete file where index.asp will be redirected to one URL only.

Thanks
Rob

12:44 am on Nov 6, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


You can redirect a whole site or one file at a time.

You can do this by using mod_rewrite in the .htaccess file, or by using a PHP script tacked onto the front of the PHP page.

4:32 am on Nov 6, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 2, 2002
posts:120
votes: 0


Hello
Thanks for the reply.

Please note that I have an Asp site and I want to implement this to not at the file level but at the URL level.

Can you Please advice. We are using IBM's red dot CMS.

thanks
Rob

8:12 am on Nov 6, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Oh that should be easy then. There is an ASP command, something like Response.Header that you can use to send the redirect. The code goes before the <html> tag of each page that you don't want people to access the content on any longer. Make sure that the response really is 301 and NOT 302 when you do it. Google for ASP 301 redirect for the 2 lines of code you need. Use WebBug to check the header.
8:42 am on Nov 6, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


<%
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://www.newdomain.com/page.html"
Response.End
%>