Category Archives: Web Development

WordPress – Increasing maximum upload size

<VirtualHost *:80> DocumentRoot  “/blah/blah/blah” ServerName    www.blahblahblah.net ServerAlias   blahblahblah.net ServerAdmin   webmaster@blahblahblah.net CustomLog     logs/access/www.blahblahblah.net.log combined ErrorLog      logs/error/www.blahblahblah.net.log # if upload_max_filesize and post_max_size are NOT the same WordPress # will set the maximum upload limit to the lower of the two values. # This was the case with WordPress 3.1 on 21st March 2011 php_value      upload_max_filesize 25M php_value     … Read More »

How to Move WordPress Blog to New Domain or Location

To update WordPress options with the new blog location, use the following SQL command: UPDATE wp_options SET option_value = replace(option_value, ‘http://www.old-domain.com’, ‘http://www.new-domain.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’; After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table… Read More »

htaccess surpress / display PHP errors

# supress php errors php_flag display_startup_errors off php_flag display_errors off php_flag html_errors off php_value docref_root 0 php_value docref_ext 0 # display php errors php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on php_value docref_root 1 php_value docref_ext 1

Vertical text in an image

<?php header (“Content-type: image/png”); // imagecreate (x width, y width) $text = str_replace(‘_’, ‘ ‘, $_GET[‘text’]); $text = ucwords($text); $img_handle = @imagecreatetruecolor (30, 180) or die (“Cannot Create image”); // ImageColorAllocate (image, red, green, blue) $background_color = ImageColorAllocate($img_handle, 0, 0, 0); //to become transparent later in the script $txt_color = ImageColorAllocate($img_handle, 255, 255, 255); //… Read More »

Category: PHP

301 redirection with Apache config or .htaccess file

<VirtualHost *:80> DocumentRoot “/home/apache/http/example.co.uk/www” ServerName www.example.co.uk ServerAlias example.co.uk ServerAlias example-ltd.co.uk www.example-ltd.co.uk ServerAlias example.net www.example.net ServerAlias example.com www.example.com ServerAdmin webmaster@www.example.co.uk #Log files CustomLog logs/access/www.example.co.uk.log combined ErrorLog logs/error/www.example.co.uk.log # redirect all non-www traffic Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.example\.co\.uk$ RewriteRule ^.*$ http://www.example.co.uk%{REQUEST_URI} [R=permanent,L] </VirtualHost>