Welcome to WebmasterWorld Guest from 54.160.131.144

Message Too Old, No Replies

Redirection 301 - On URL or on file?

     

robinponty

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

10+ Year Member



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

g1smd

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

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



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.

robinponty

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

10+ Year Member



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

g1smd

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

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



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.

g1smd

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

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



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