ashrafjp Posted January 22, 2016 Posted January 22, 2016 Hi, can I setup/ modify apache virtual host?I want to create a PURL system on my site (e-library)PURL is "Persistent URLs", URLs that do never change or expire, because they are, in fact, forward-URL from a specific static one to real URL.. if real URL is dead, I change it and the static one (the one for user) is the same.There are many ways to do this, most of them are paid, and a few of them are free, with some scripts and setup procedures..One free way with easy setup requires setup/ modify apache virtual host, is this supported here? If not, I`ll use other available free ways, but they require more setup tasks.There are solutions with no setup at all (in cloud and easy), but are expensive. Thanks >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>More details (Just in case they are needed) 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. 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.TLDContent: IP Address of your ServerTTL: 300 (300 typically works well for me) 2) Setup/Modify the Apache Virtual HostOn the ServerAlias config line add *.DOMAINNAAME.TLD. It should roughly look something like: Code: ServerName DOMAINNAME.TLD ServerAlias *.DOMAINNAME.TLD ... 3) Setup .htaccess to rewrite requests to your PHP fileIn your directory specified in the VirtualHost add a file called .htaccess. Mine looks something similar to:Code:RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} -f [OR]RewriteCond %{REQUEST_FILENAME} -dRewriteRule ^ - [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 scriptWhich 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. Sorry, I`ll colse this topic..This require paths (ebook files) to be available under same domain.. and here we have only 500MB..I`ll need another hoster or a paid cloud solution for this.Thanks
Recommended Posts