Results 1 to 9 of 9

Thread: PURL scripts

  1. #1
    Join Date
    Feb 2008
    Posts
    39

    PURL scripts

    I was wondering if anybody knew of any good resources for PURL creation and scripts? or point me to a forum post on the subject?


    Thanks!

  2. #2
    Join Date
    Oct 2002
    Location
    /roof/ledge
    Posts
    28,090
    Perhaps you mean PERL (Practical Extraction and Reporting Language)?

    You could start here: http://www.google.com/search?q=perl+...2&spell=1&sa=X
    Your one stop shop for decentralization

  3. #3
    Join Date
    Feb 2008
    Posts
    39
    Thanks for the response but I actually meant PURL http://en.wikipedia.org/wiki/Persist...source_Locator

    I also did a google search for PURL but only found companies that offer the software/services for sale and I was hoping to find an open
    source solution or some helpful scripts to get me going.

    Thanks!

  4. #4
    Join Date
    Oct 2002
    Location
    /roof/ledge
    Posts
    28,090
    Your one stop shop for decentralization

  5. #5
    Join Date
    Feb 2008
    Posts
    39
    Thanks again, but unfortunately that search was not helpful either. I just want to learn how to make PURLS in php server side. Its being used for a marketing campaign.

  6. #6
    Your Wikipedia reference links to Persistent URLs - these are simply HTTP status codes coupled with a URL. An example of implemented a 301 redirect (permanently moved) would be:
    Code:
    <?php
    header( "HTTP/1.1 301 Moved Permanently" ); 
    header( "Location: http://www.new-url.com" );
    ?>
    However, I suspect that you may have meant Personalized URLs - often used in marketing campaigns for tracking and personalization.

    To create these types of PURLs (such as Username.Domain.com) you will need to setup wildcard subdomains in the DNS records (looks like *.domain.com) and then setup all subdomains to route to a specific PHP script for handling. This can be easily done using mod_rewrite in Apache via .htaccess. Note that most shared hosts do not allow wildcard subdomains.

  7. #7
    Join Date
    Feb 2008
    Posts
    39
    Thanks for the reply that has been helpful!
    Yes I meant Personalized URLS, do you know of a tutorial or source that shows you the steps to set this up? We own our server so we have access to try this.

  8. #8
    I don't know of any great tutorials so here's a quick write-up.

    Basic steps for setting up a Wildcard subdomain (assuming a LAMP stack):

    1) DNS Record

    Add a DNS record, here are the settings:
    Type: "A" Record (More information on DNS record types)
    Name: *.DOMAINNAME.TLD
    Content: IP Address of your Server
    TTL: 300 (300 typically works well for me)

    2) Setup/Modify the Apache Virtual Host
    On the ServerAlias config line add *.DOMAINNAAME.TLD. It should roughly look something like:

    Code:
    <VirtualHost *:80>
      ServerName  DOMAINNAME.TLD
      ServerAlias *.DOMAINNAME.TLD
    
      ...
    </VirtualHost>
    3) Setup .htaccess to rewrite requests to your PHP file
    In your directory specified in the VirtualHost add a file called .htaccess. Mine looks something similar to:
    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    I'm basically telling all requests to this URL to go to index.php. You could also specify only patterns making your personlized URLs.

    4) Write your Personalized PHP script
    Which ever file you redirect to in .htaccess will need to begin the process of analyzing the $_SERVER array to determine what to display to the user.

  9. #9
    Join Date
    Feb 2008
    Posts
    39
    @webstartavenue Thank you for this! This is actually very helpful and gets me in the right direction.

Similar Threads

  1. Replies: 2
    Last Post: 12-18-2009, 01:59 AM
  2. Replies: 7
    Last Post: 08-08-2007, 05:28 AM
  3. Iframe Scripts. Scripts easy to include to your web design
    By lasse in forum Other Offers & Requests
    Replies: 0
    Last Post: 10-14-2006, 08:12 AM
  4. Replies: 0
    Last Post: 10-01-2006, 06:37 AM
  5. Replies: 10
    Last Post: 05-27-2005, 11:44 AM

Posting Permissions

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