force www for http and https

RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] Found here:

silex and the trailing slash

Wrong route definition: $app->get(‘/demo’, function() use($app) { return “demo”; }); Right route definition: $app->get(‘/demo/’, function() use($app) { return “demo”; }); The .htaccess file: <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f # RewriteRule ^ index.php [QSA,L] RewriteRule ^ index.php [QSA,L] </IfModule>  

creating a vagrant base box from an existing base box

A vagrant Ubuntu Server 32bit 14.04 LTS with Apache, MySQl, PHP and several development tools installed. The server contains the following components: apache mysql php 5.5 sqlite vim git composer nodejs, npm cUrl xdebug The result can be used here: Prepare the server Initzialize vagrant: vagrant init ubuntu/trusty32 Edit the initial vagrant Read more…

My Apache cheat sheet

The VirtualHost configuration is located here /etc/apache2/sites-available Defining a VirtualHost <VirtualHost *:80> ServerName DocumentRoot /var/www/html/my-app/ </Virtualhost> I am using Vagrant on Windows, so I have to add this domain to my Windows hosts file: The Apache Service and its commands sudo service apache2 [command] Possible commands: start stop graceful-stop Read more…