Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Thanked 0 Times in 0 Posts

    Cool Help -- Url redirects that members can use?

    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.


    Last edited by 4mguy; 12-10-2007 at 07:57 AM. Reason: Checking my notification preferences.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    London, England
    Thanked 2,563 Times in 2,541 Posts
    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;

    Last edited by Philip M; 12-10-2007 at 09:32 AM. Reason: Improvement


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts