User Tools

Site Tools


Minimal page requirements

Suitable for most pages, contains link to screen/print CSS and meta description&keywords

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" lang="en" xml:lang="en">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="css/screen.css" media="screen"/>
	<link rel="stylesheet" type="text/css" href="css/print.css" media="print"/>
	<title>website title</title>
	<meta name="description" content="Page description goes here !" />
	<meta name="keywords" content="keywords, key, words" />


Minimal site declaration

<VirtualHost *:80>
        ServerAdmin admin@mysite.tld
        ServerName mysite.tld
        DocumentRoot /var/www/mysite

        CustomLog ${APACHE_LOG_DIR}/sites/mysite-access.log combined
        ErrorLog ${APACHE_LOG_DIR}/sites/mysite-error.log


Redirect depending on language

To send a user to a different page depending on their browsers language:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:Accept-Language} ^fr* [NC]
RewriteRule ^$ /fr/ [L]
RewriteRule ^$ /en/ [L]

If the users language is French, they go to /fr/, for any other language they go to /en/
We ask the condition to start with “fr”, and can have anything after that, the [NC] means that the language is not case sensitive. The [L] means that if the condition is met, we don't read any further.

blank space at beginning of page

Symptom: when using PHP's include(), a blank space is inserted in the beginning of the page
Cause: pages have been edited with different editors and/or changed format too often (utf8/ansi), the editor adds an invisible character at the beginning of the document to define this.


file_get_contents() doesn't work with https

Use cURL:

function fetchUrl($url) {
$data = curl_exec($ch);
return $data;
webdev.txt · Last modified: 2013/12/25 16:47 (external edit)