Saturday, November 16, 2013

Automagic Mod_Vhost_Alias for Vagrant precise PHP

Just sharing my Apache vhost to enable automatic virtual hosting for my development environment.
This will enable anything you put to '/vagrant/www/*' a vhost with a public directory. Useful if you are working with frameworks that redirects everything to public/index.php (e.g. Zend Framework)
A directory like:
vagrant/
    www/
        mysite/
            public/
        myothersite/
            public/

Will automatically setup:
1. http://mysite.local
2. http://myothersite.local

And here is the configuration:
<Virtualhost *:80>
    VirtualDocumentRoot "/vagrant/www/%-2+/public"
    ServerName vhosts.local
    ServerAlias *.local
    UseCanonicalName Off
    LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon

    ErrorLog  /var/log/apache2/local-error_log
    CustomLog /var/log/apache2/local-access_log common

    <Directory ~ "/vagrant/www/[a-z0-9_]+/public">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order Allow,Deny
        Allow from all

        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} -s [OR]
            RewriteCond %{REQUEST_FILENAME} -l [OR]
            RewriteCond %{REQUEST_FILENAME} -d
            RewriteRule ^.*$ - [NC,L]
            RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
            RewriteRule ^(.*) - [E=BASE:%1]
            RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
        </IfModule>
    </Directory>
</Virtualhost>

13 comments:

oakleyses said...

tory burch outlet, longchamp outlet, burberry, ray ban sunglasses, tiffany and co, nike outlet, replica watches, louis vuitton, ray ban sunglasses, nike air max, jordan shoes, polo ralph lauren outlet, michael kors outlet, tiffany jewelry, michael kors outlet, christian louboutin outlet, burberry outlet online, michael kors outlet, michael kors, oakley sunglasses, longchamp, prada outlet, prada handbags, cheap oakley sunglasses, oakley sunglasses, oakley sunglasses, ugg boots, louboutin shoes, michael kors outlet, ugg boots, polo ralph lauren outlet, louis vuitton outlet, nike free, chanel handbags, louboutin outlet, louis vuitton outlet, oakley sunglasses, ugg boots, replica watches, michael kors outlet, kate spade outlet, uggs on sale, nike air max, louboutin, louis vuitton, louis vuitton

oakleyses said...

air jordan pas cher, ray ban uk, nike roshe, true religion jeans, air force, abercrombie and fitch, north face, new balance pas cher, sac longchamp, longchamp pas cher, mulberry, oakley pas cher, nike free run uk, coach outlet, nike blazer, hermes, michael kors, nike air max, air max, hollister pas cher, true religion jeans, ralph lauren pas cher, vans pas cher, michael kors, coach outlet, true religion jeans, hollister, michael kors, north face, nike air max, nike roshe run, coach purses, burberry, lululemon, michael kors, lacoste pas cher, hogan, tn pas cher, sac guess, replica handbags, louboutin pas cher, vanessa bruno, timberland, kate spade handbags, converse pas cher, ralph lauren uk, nike free

oakleyses said...

moncler, moncler outlet, marc jacobs, moncler, hollister, montre pas cher, vans, ray ban, replica watches, pandora charms, louis vuitton, supra shoes, sac louis vuitton pas cher, pandora jewelry, swarovski, pandora charms, moncler, bottes ugg, barbour, canada goose, ugg,uggs,uggs canada, louis vuitton, doke gabbana outlet, converse, louis vuitton, lancel, louis vuitton, hollister, moncler, pandora jewelry, doudoune canada goose, juicy couture outlet, nike air max, converse outlet, barbour jackets, moncler, ugg,ugg australia,ugg italia, links of london, moncler, gucci, canada goose outlet, canada goose, canada goose outlet, coach outlet, canada goose uk, ugg boots uk, canada goose, juicy couture outlet, ugg pas cher, wedding dresses, canada goose

chenlina said...

chenlina20160127
canada goose jackets
cheap ugg boots
ugg boots
christian louboutin outlet
cheap toms
coach outlet
oakley sunglasses
ugg boots
toms outlet
abercrombie and fitch new york
vans shoes sale
louis vuitton outlet
coach factory outlet
ray ban sunglasses
longchamp outlet
fitflops sale clearance
coach factory outlet
michael kors bag
hollister
fake oakley sunglasses
tod's shoes
cheap jerseys
louis vuitton
gucci outlet
tory burch outlet
cheap air jordans
ugg boots
supra shoes
louis vuitton
oakley vault
cheap nfl jerseys
louis vuitton outlet
nike trainers uk
michael kors handbags
lebron 11
louis vuitton outlet
cheap oakley sunglasses
uggs outlet
ugg sale
polo outlet
as

vanahi688 said...


Thuốc shisha
bình shisha giá rẻ
ke toan ha noi
hoc tin hoc van phong
dich vu ke toan
công ty kê toán hà nội
tieng anh newlight
dia chi hoc ke toan
dich vu ke toan gia re
trung tam ke toan ha noi
ke toan bac ninh
hoc chung chi ke toan
cong ty ke toan ha noi
kế toán hà nội
đào tạo kế toán tphcm
đào tạo kế toán tổng hợp
dạy kế toán thuế
đào tạo kế toán
trung tâm đào tạo kế toán hà nội
kế toán hà nội kthn
cong ty dich vu ke toan ha noi
day hoc ke toan
hoc ke toan thue
học kế toán thuế
trung tâm kế toán
đào tạo kế toán tốt nhất
làm báo cáo tài chính cuối năm
dịch vụ kế toán

Unknown said...

thomas sabo uk
herve leger outlet
coach outlet online
louis vuitton handbags
rolex watches
ugg boots
iphone case
cheap snapbacks
uggs outlet
michael kors outlet online
cartier outlet
michael kors outlet clearance
soccer jerseys
oakley sunglasses
celine outlet
canada goose outlet
coach outlet
futbol baratas
nike air force 1
longchamp outlet
coach outlet
michael kors outlet
ugg outlet
canada goose jackets
hermes birkin
polo ralph lauren
michael kors outlet store
air jordan 4
cheap uggs
tory burch outlet
tiffany and co jewelry
louis vuitton outlet
coach outlet
michael kors bags
ugg boots
chanyuan0913

Unknown said...

ed hardy uk
versace shoes
bills jerseys
christian louboutin shoes
cheap oakley sunglasses
birkenstocks
oakland raiders jerseys
louis vuitton pas cher
mlb jerseys
colts jerseys

Digital Marketing Agency said...

Quikcbooks Support Phone Number

Quikcbooks Support Number
Quikcbooks Support Phone Number
Quikcbooks Tech Support Number
Quikcbooks Technical Support Number
Quikcbooks Tech Support Phone Number
Quikcbooks Technical Support Phone Number
Quikcbooks Helpdesk Phone Number
Quikcbooks Customer Service Phone Number
Quikcbooks Customer Service Number
Quikcbooks Customer Support Number

Quicken Support Phone Number

Quicken Support Number
Quicken Support Phone Number
Quicken Tech Support Number
Quicken Technical Support Number
Quicken Tech Support Phone Number
Quicken Technical Support Phone Number
Quicken Helpdesk Phone Number
Quicken Customer Service Phone Number
Quicken Customer Service Number
Quicken Customer Support Number

Sage Support Phone Number

Sage Support Number
Sage Support Phone Number
SageTech Support Number
Sage Technical Support Number
Sage Tech Support Phone Number
Sage Technical Support Phone Number
Sage Helpdesk Phone Number
Sage Customer Service Phone Number
Sage Customer Service Number
Sage Customer Support Number

Vanwingerden Urick said...

Gifts made with Visa are deductible for the duty year regardless of the possibility that you don't make the installment until the next year.Cash Advance

Vanwingerden Urick said...

In the event that your obligation is to a great degree vast, you might need to contact an expert credit directing administration to take a gander at conceivable choices for obligation settlement, solidification choices or as a last outcome,Payday Loans

Anonymous said...

You've seen them in the city corner, however have you seen all the diverse sites that give data on the most proficient method to set up your own particular car title credit business?Cash Advance Corona

Anonymous said...

Read the assention of automobile title credits before you sign it to guarantee that you have the privilege to make legitimate move if your purchaser rights are abused. If all else fails, accept lawful exhortation to guarantee you don't fall into an obligation trap. Auto Title Loans

Mckelvey Broomfield said...

Many individuals require the chance to acquire a little measure of money that would be accessible in their next paycheck and a few organizations will go after that.Payday Loans Chula-vista