04-17-2004, 07:05 PM
Need a bit of help here. I own the domain name www.livescripts.co.uk and have just purchased www.livescripts.net. However I want to keep the old domain. All the files will go on www.livescripts.net, and I want a script that will redirect an URL request on www.livescripts.co.uk to the euivalent URL on www.livescripts.net.
For example, if a user were to request www.livescripts.co.uk/somedir it would be automatically redirected to www.livescripts.net/somedir. I have a feeling that it can be done through HTTP error messages. I have custom pages assigned for each error code. If a 404 is enoucntered, the error appears, but the requested URL remains in the address bar.
If all errors were redirected to a PHP script that would check the requested URL, and forward to www.livescripts.net + requested URL.
Any help would be greatly appreciated.
04-18-2004, 12:30 AM
ErrorDocument 404 /redirect.php
04-18-2004, 11:46 AM
Sorry, can't do that, I'm on a Windows server with IIS 6.0
04-18-2004, 11:53 AM
yes go in to internet servise manager and add redirect.php to custom error page for 404 error
04-18-2004, 12:14 PM
It doesn't seem to work. I just get a normal IE 404 error.
04-18-2004, 12:16 PM
did you make it the default
04-18-2004, 12:27 PM
What exactly do you mean? I made it the default error page, yes. When a 404 error occurs it goes to redirect.php.
Still does not work though :confused:
04-18-2004, 12:33 PM
edit/ sorry didnt quite understand last question till i read it again
wher is redirect.php on server
in inet servises in left panel highlight the folder containing site
right click select properties then custom errors
scroll down list find 404 highlight and edit properties
select file browse to new file hit ok
if windows asks to set child properties select all and hit ok
that should do it
04-18-2004, 12:42 PM
Nope, still 404. The file is at http://www.livescripts.co.uk/redir.php. I have made sure that if a 404 error is encountered it will go to that file.
PS. I'm testing it using www.hotscripts.com instead of www.livescripts.net, as livescripts.net is not yet fully running.
04-18-2004, 12:54 PM
sorry requst_uri is apache on windows its like below you can see what you server is using by using phpinfo();
04-18-2004, 12:59 PM
Thanks, but it still doesnt work :rolleyes: I know hotscripts have a /PHP directory. So it I set the script to
and typed in www.livescripts.co.uk/PHP it should redirect to www.hotscripts.com/PHP right?
But it doesn't :confused:
04-18-2004, 03:00 PM
slight mistake $SERVER sholud be $_SERVER corrected below
so your being redirect to redir.php by error 404 but its not redirecting on to
other server may be the php isnt being phrased.
04-18-2004, 06:06 PM
may be the php isnt being phrased.
Sorry Sidney, what does that mean? I'm not very good with PHP.
04-18-2004, 06:14 PM
should be parsed ie the page is passed through the php parser and the output is then sent to the browser.
any way ive been round a m8ts house and on his widows iis 5 tryed it out
i couldnt get it to hold the path_info when the server redirect on error the path_info was changed to the error page.
this dosent happen with .htaccess if you use the relative url rather than
the full url
so it works perfectly in apache and .htaccess
but not being to good on windows i cant see a way to hold the initial path_info