PDA

View Full Version : Redirecting URL with all POST parameters



kippesp
Wed 30th Jan '02, 4:18pm
What would be a good way to initiate a redirect link while maintaining all the information right of any '?'?

For example:
http://myurl.org/forums/showthread.php3?s=&threadid=123&parm=whatever
would redirect to
http://myurl.org/forums/showthread.php?s=&threadid=123&parm=whatever

Thanks

Mark Hensler
Wed 30th Jan '02, 7:20pm
Thats the GET method, not POST. You should be able to use ModRewrite in .htaccess (I've not used it much, so I'll let someone else post the syntax).

kippesp
Thu 31st Jan '02, 11:18am
Thanks for the reply. I'll go ahead and post my solution even if it may not be the best. If my server is enabled to read the .htaccess file in each directory, I'll try your solution.

I'm posting my solution here since I already started this thread.

genericfilename.php3
<?php
// Rename this file to the filename to redirect.
// For example, rename to myfile.php3 to redirect to myfile.php

error_reporting(7);
require('./global.php');

// Include redirect logic
require('./redirector.php');

?>
file: redirector.php
<?php

if (preg_match("#\.php3#",$REQUEST_URI)) {
$new_uri=preg_replace("#\.php3#",".php",$REQUEST_URI);
} else {
// No script specified. Must default.
$new_uri=$REQUEST_URI."index.php";
}

eval("standardredirect(\"".gettemplate("redirect_php3script")."\",\"$new_uri\");");

?>
template: redirect_php3script
Put redirect text here