#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    1
    Rep Power
    0

    Attempting to redirect to a subdomain based on info in a query box


    Good morning!
    I've been racking my poor little brain trying to figure this out:

    I have a ton (150+) subdomains with random characters that I give out on digital download cards for a record label, what I'm begging you kind folks for is a way to create a query box and the data put in that query box appends to the domain name

    IE

    [ 11551 ] |Submit button|

    Then, the data in query automatically redirects to 11551.Mydomain.com

    same thing if they put 'muppets' in the query and hit submit, you'd get muppets.mydomain.com (not saying that's a query, but just as an example)

    Thank so much in advance!!!
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0

    Here is an awnser


    Originally Posted by SuperRandy
    Good morning!
    I've been racking my poor little brain trying to figure this out:

    I have a ton (150+) subdomains with random characters that I give out on digital download cards for a record label, what I'm begging you kind folks for is a way to create a query box and the data put in that query box appends to the domain name

    IE

    [ 11551 ] |Submit button|

    Then, the data in query automatically redirects to 11551.Mydomain.com

    same thing if they put 'muppets' in the query and hit submit, you'd get muppets.mydomain.com (not saying that's a query, but just as an example)

    Thank so much in advance!!!
    here is a function to use, just make sure to pass the useres input into it.
    Code:
    var redirect = function( code ){
        location.replace(code);
    }
    please note i did not test this code i just threw it together. If you are using HTMl for the submit then make it so its a forum that sends the code they input into the function.
  4. #3
  5. No Profile Picture
    buildmyweb.org
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Location
    NY
    Posts
    62
    Rep Power
    8
    if i understand what youre trying to do, you could do it with php also. something like

    PHP Code:
    $subdomain $_POST['subdomain'];

    header('Location: http://mydomain.com/' $subdomain ); 
    Freelance Web Developer | Web Hosting |
    PHP Applications
    Web Development, Hosting, Graphic Design, SEO

IMN logo majestic logo threadwatch logo seochat tools logo