Apache (12)

Mac OS X vhosts not working after yoemite / el capitan upgrade

This is because you forgot to back up your httpd.conf… – easily fixed: First, back up the current httpd.conf: (you’ll need to be root, so either su or run the following commands with sudo) cd /etc/apache2 mv httpd.conf httpd.conf.preUpgrade mv httpd.conf~previous httpd.conf and then restart apache: apachectl restart now your local vhosts will work again.

SVG Not Displaying

  • September 11, 2013
  • Apache

I’ve just been configuring and setting up a server environment for a project i’ve been building. Everything working at it should, except my SVGs were not showing. In this instance, Apache doesn’t know how to serve them up, so I added the following lines to a .htaccess file in the document root: [code] AddType image/svg+xml […]

php session save path permission denied

seems an update in plesk overnight (twice in the last few weeks) has cocked up the php session_save_path: no websites were able to write any sessions, so nothing added to baskets… angry customers… ahem. not sure whether i’m blaming plesk just yet, i’m investigating. but the problem in all error logs is: [code]mod_fcgid: stderr: PHP […]

apache rewriterule: rewrite url to hash

After building a new website for a client, i needed to redirect their old URLs to new ones, normally a trivial task. But in this case the new site is driven by hash urls, so we need to rewrite url to hash url, such as: from: /apage to domain.co.uk/#!/area/section/bit and variations on that. By default […]

creating html snapshots for google

A recent project required that we use hash navigation for speedy access to content, this also eeded to be indexed well, and seo’d up to the eyeballs, and so i set aboutand creating html snapshots for google. After reading, becoming daunted and almost put off, i realised that its actually a very simple process indeed! […]

parse htm files for php under cgi

  • September 17, 2012
  • Apache

a few older sites that were built by fools using .htm as the extension and telling the apache to serve them up as .php were recently moved across to heart internet. seeing as the php is running under cgi on heartinternet, we will need the following: [code]AddHandler cgi-script .htm SetEnv PHP_EXTENSION .htm[/code] in the .htaccess […]

force a trailing slash

add a trailing slash to all URLs. [code]RewriteCond %{REQUEST_URI} /+[^\.]+$ RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L][/code]

using get variables

This example changes /product.php?product_id=909 to /product?id=909 [code]RewriteCond %{QUERY_STRING} product_id=(.*) RewriteRule ^product.php(.*) /product?id=%1[/code]

remove www.

remove the www. [code]RewriteCond %{HTTP_HOST} !^domain.com$ [NC] RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301][/code]