Skip to content

Instantly share code, notes, and snippets.

@jjsty1e
Last active June 5, 2017 08:11
Show Gist options
  • Save jjsty1e/352bcdeb63f2d5d0f07748e746268a75 to your computer and use it in GitHub Desktop.
Save jjsty1e/352bcdeb63f2d5d0f07748e746268a75 to your computer and use it in GitHub Desktop.
apache https configuration
<VirtualHost *:443 *:80>
DocumentRoot "/path/to/webRoot"
ServerName yourServerName
<IfModule ssl_module>
SSLEngine on
SSLCertificateFile "/path/to/crtFileName.crt"
SSLCertificateKeyFile "/path/to/keyFileName.key"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*?)$ https://%{SERVER_NAME}$1 [L,R=301]
</IfModule>
</VirtualHost>
# symfony configuration
# * means all site roo path
<Directory "/var/www/*/web">
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/app_dev.php [L]
AllowOverride None
</Directory>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment