Contest Script or Code to manage sub-domain redirection - PhotoSales NZ - $40USD PayPal

Discussion in 'Design Contests' started by FlexiHost, Apr 15, 2010.

  1. #1
    Ok, here is a tricky one.

    First person to sort us out the following code wins - pretty simple really.

    Our site is:
    http://www.photosales.co.nz

    At the moment, we have to manually create sub domains for photographers eg http://robyn.photosales.co.nz whcih then forwards on to http://www.photosales.co.nz/view_photog.php?photogid=163

    We want a script that can either create this automatically (we can pass details like photographer ID's) based on what they want.

    Reading round, it looks like this is possible - I have been Googling "cpanel auto create subdomains" and the like, and have found some scripts - but nothing that will do it exactly how we want it.

    Thoughts?
     
    FlexiHost, Apr 15, 2010 IP
  2. opticalpigion

    opticalpigion Well-Known Member

    Messages:
    220
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    168
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    first you have to create subdomain with " * "

    e.g http://*.photosales.co.nz


    later we can use this * to redirect to anyother users page.

    yess u dont have to make different domain name for users. just this * is enough.

    add this code into your .htaccess

    
    RewriteEngine on
    RewriteCond %{http_host} .
    RewriteCond %{http_host} !^photosales.co.nz [NC]
    RewriteCond %{http_host} ^([^.]+)\.photosales.co.nz [NC]
    RewriteRule ^(.*) http://www.photosales.co.nz/view_photog.php?photogid=%1 [R=301,L,QSA] 
    
    Code (markup):
    u have to get [2] details
    [1] name
    [2] photo album id.

    so it will work like

    http://name.sitename.com n it will display that photoid page.

    it called mod rewrite.

    if u face any error than i can help u to sort this.
     
    opticalpigion, Apr 16, 2010 IP
  3. FlexiHost

    FlexiHost Member

    Messages:
    236
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    Lucas0123 has won this comp - thanks for the coding job you did on this script.

    Payment has been sent via PayPal.
     
    FlexiHost, Apr 17, 2010 IP