Last active
January 3, 2016 02:59
-
-
Save SimonRice/8398737 to your computer and use it in GitHub Desktop.
My useful Symfony virtual hosts file - covers Symfony 1 & 2 - means every subdirectory becomes a virtual host, leaving you just to put an entry in your hosts file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Listen 80 | |
NameVirtualHost *:80 | |
<virtualhost *:80> | |
ServerName sf1.dev | |
ServerAlias *.sf1.dev | |
UseCanonicalName Off | |
VirtualDocumentRoot "/Users/simon/Developer/SF1Projects/%1/web" | |
<directory "/Users/simon/Developer/SF1Projects/*/web"> | |
Allow from All | |
Options FollowSymLinks ExecCGI | |
<IfModule mod_rewrite.c> | |
# Copied from Symfony's .htaccess, with RewriteBase enabled | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^$ index.html [QSA] | |
RewriteRule ^([^.]+)$ $1.html [QSA] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ index.php [QSA,L] | |
</IfModule> | |
</directory> | |
<directory "/Users/simon/Developer/SF1Projects/*/web/sf"> | |
AllowOverride All | |
Allow from All | |
</directory> | |
</virtualhost> | |
<virtualhost *:80> | |
ServerName sf2.dev | |
ServerAlias *.sf2.dev | |
UseCanonicalName Off | |
VirtualDocumentRoot "/Users/simon/Developer/SF2Projects/%1/web" | |
<directory "/Users/simon/Developer/SF2Projects/*/web"> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride None | |
Order allow,deny | |
allow from all | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ /app.php [QSA,L] | |
</IfModule> | |
</directory> | |
</virtualhost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment