View Full Version : Help -- Url redirects that members can use?

12-10-2007, 06:55 AM
I need help on this one.

I don't know if javascript, or php or .htaccess is the right solution for this one - so please advise. My programming skills are limited to html and cut and paste. With that in mind here is where I need help.

I have a PHP script that lists properties. It gives each property a listing ID such as 44-10. The Url for the property would be

This is obviously too clumsy to use as a referal url for media advertising. Can I use javascript to redirect so that the member can use an url like
http://www.mydomain.com/44-10 and have it redirect to http://www.mydomain.com/search_id.php?ID=44-10 ?

If so, what is the best method and what is the code to use? I've spent hours looking on the Internet and have not found a solution.



Philip M
12-10-2007, 08:22 AM
Try this:-

<form name = "myform">
<input type = "text" name = "url" size = "40" onchange = "fixUrl(this)">

<script type = "text/javascript">
function fixUrl(which) {
var newUrl = which.value.replace(/(\d+)/, "search_id.php?ID=$1");
//alert (newUrl); // delete after testing
window.location = newUrl;