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: http://stackoverflow.com/questions/4916222/htaccess-how-to-force-www-in-a-generic-way

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: https://atlas.hashicorp.com/alexwenzel/boxes/webdev 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 app.dev 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: 192.168.10.10 app.dev The Apache Service and its commands sudo service apache2 [command] Possible commands: start stop graceful-stop Read more…