Portal Home > Knowledgebase > Articles Database > PURL scripts
PURL scripts
Posted by raulb, 11-04-2011, 01:14 PM |
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!
|
Posted by bear, 11-04-2011, 01:20 PM |
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
|
Posted by raulb, 11-04-2011, 01:21 PM |
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!
|
Posted by bear, 11-04-2011, 01:31 PM |
Ah, thanks.
Try this instead?
http://www.google.com/search?complet...e+Search&gbv=2
|
Posted by raulb, 11-04-2011, 01:39 PM |
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.
|
Posted by webstartavenue, 11-06-2011, 01:09 PM |
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:
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.
|
Posted by raulb, 11-06-2011, 01:16 PM |
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.
|
Posted by webstartavenue, 11-06-2011, 01:59 PM |
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:
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:
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.
|
Posted by raulb, 11-17-2011, 12:49 PM |
webstartavenue Thank you for this! This is actually very helpful and gets me in the right direction.
|
Add to Favourites Print this Article
Also Read