[pmwiki-users] Hi, I've made it a little easier for PmWiki users.

Petko Yotov 5ko at 5ko.fr
Mon Oct 1 10:34:36 CDT 2012


John writes:
> Hi, I've made the big Apache speed-up and reliability fix I hit upon a bit  
> easier for PmWiki users. Here is a link to all the correctly written htaccess

I'm pretty sure that this installation actually slows down your server. 

1. Why do you process *.html and *.js static files with the PHP engine? It  
is not about speed, because this would be 4 to 100 times slower than the  
regular way, Apache serving a static file. It is not about optimizing  
PmWiki, because PmWiki doesn't read program code in *.html files.

2. For a simple redirection, a single .htaccess file at the document root  
needs to be modified, you don't need files in every subdirectory. Here is  
what we use on PmWiki.org to redirect (www)?.pmwiki.(com|net|org|fr) to  
www.pmwiki.org :

  # Redirect anything other than *.pmwiki.org to www.pmwiki.org
  RewriteCond %{HTTP_HOST} !pmwiki.org$ [NC,OR]
  RewriteCond %{HTTP_HOST} ^pmwiki.org$ [NC]
  RewriteRule ^(.*)        http://www.pmwiki.org/$1 [L,R]

We want the "www" part, but if we didn't, we would have just 2 lines:

  RewriteCond %{HTTP_HOST} !^pmwiki.org$ [NC]
  RewriteRule ^(.*)        http://pmwiki.org/$1 [L,R]

This in the root .htaccess file only, not in all subdirectories.

I don't want to write your recipe, but... oh boy.

3. The directories with "Deny from all" really don't need any additional  
lines. As the other directories - having a .htaccess file that is not  
required slows down the server (which needs to open it and parse it).

4. If your DNS server is configured correctly and allows DNS caching, by not  
using "www" your visitors may actually save a single microsecond, but they  
spend much more, probably a full second, when they follow a redirection. :-)

Having a single host is reportedly better for SEO, so the lost second is  
worth it, but not for speed or reliability.

5. PHP is an interpreted language and PmWiki most often renders the HTML  
page on the fly which is obviously slower than static HTML. But it has a  
built-in cache feature which allows to skip most of the processing when it  
is possible. There is also a recipe which stores the output as static HTML  
and lets Apache completely bypass PmWiki when it is possible. See

  http://www.pmwiki.org/wiki/Cookbook/FastCache

Petko




More information about the pmwiki-users mailing list