Forum Moderators: coopster & phranque

Message Too Old, No Replies

How to initiate automatic 301 redirect

apache server, no SSI or .htaccess, perl only

         

Masayo

6:10 pm on Oct 16, 2008 (gmt 0)

10+ Year Member



I've spent hours searching for the answer to this. I think I'm missing the forest for the trees, so please help if possible: I'm taking down an old site that duplicated one with a good domain name on a good server, and I want to set up 301 redirects for each old page. The old site was a freebie with an ISP, and has very limited features. I can use cgi with perl, but not .htaccess files, php, or server side includes. I uploaded a script to the cgi folder and it does work - it redirects to the new domain. My question is, how do I get this script to execute when a visitor goes to oldsite.com/index.html? I see how creating a form would let the submit button trigger the script, but surely there's a way to do it so the visitor doesn't have to click anything?

The files on this old site must be .htm or .html. No SSI, php, or .htaccess. Right now I've got meta redirects with the timing set to 0 and page titles "301 Moved Permanently" in the hope that search engines won't be too upset.

[edited by: Masayo at 6:13 pm (utc) on Oct. 16, 2008]

phranque

7:48 pm on Oct 16, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld [webmasterworld.com], Masayo!

i would suggest reading this thread and some of the linked threads within and then do what you have to do:
[webmasterworld.com...]

and/or ask more questions...

Masayo

10:20 pm on Oct 16, 2008 (gmt 0)

10+ Year Member



Thank you for the quick reply, phranque. I followed that link and the others within, and the point seems to be that meta redirects with 0 delay are acceptable substitutes for http redirects, but not necessarily 100% effective, so if at all possible it's best to use http redirects. I won't lose any more sleep over it, but if there is a way to get around the limitations of this host and do it properly....

phranque

6:19 am on Oct 17, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you could try replacing your index.html with something like this and see if the server will pass the headers untouched:
HTTP/1.1 301 Moved Permanently
Location: http://www.example.com/
Content-Type: text/html

<html>
<head>
<title>301 Moved Permanently</title>
</head>
<body>
<h1>Moved Permanently</h1>
<p>page has moved permanently to <a href="http://www.example.com/index.cgi">http://www.example.com/index.cgi</a>.</p>
</body>
</html>

Masayo

8:19 pm on Oct 20, 2008 (gmt 0)

10+ Year Member



I tried this but my server didn't cooperate. Oh well. Not so bad with just the meta redirects so I'll leave it at that. Thank you for the help.