OK, just found out where I am going wrong. And I am going wrong in more ways than one. Firstly, I need to modify the /etc/apache2/sites-available/default to allow .htaccess rules to override the httpd.conf. Really I should not use .htaccess, but as I am using my Linux as a test environment for my Tranquillizer website, which does use .htaccess, I will stick with it for now.
So this is what I am about to do:
In /etc/apache2/sites-available/default:
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2′s
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
I shall change “AllowOverride None” to “AllowOverride All”
This tells Apache that it’s okay to allow .htaccess files to over-ride previous directives. This means that I can get php code parsed inside html files, which is essential for my template system. I place this code into my .htaccess:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
Then I need to restart Apache so that the changes take effect. I’ll report back in a moment.
Update: Success!!! I did not need to restart Apache, the instruction was:
sudo /etc/init.d/apache2 reload
Which seems subtly different. It worked though. So I now have a test web environment for my static pages. Next task is to set up MySQL so that I can test and develop my Drupal, Pligg and phpdirectory subdomains.
Final question I have…… and will hopefully find an answer for is:
When viewing pages in http://localhost/ all links obviously point to the “wrong” place, i.e. the live website. How do I make it so that tranquillizer.co.uk is always replaced with http://localhost/ ? If that is possible, then I will be able to navigate around my test environment. I am sure it is, and if not, what is the solution to navigating through sites on the server?