Page 1 of 1

Template System

Posted: Thu Feb 09, 2012 12:25 am
by wrichards8
Template tutorial helped me do .htaccess things (useful for SEO). but one comment I would make is to use
strtolower($_GET["name"])
just to make sure that it works even if someone types in HOME or HoMe or something

Re: Template System

Posted: Tue Feb 21, 2012 9:19 pm
by bowersbros
If your on about htaccess, i dont think that PHP code such as the strtolower() function you suggested would work, since PHP is a seperate system to Apache, however; there is the htaccess flag that you can use.
RewriteMap tolowercase int:tolower 
RewriteRule ^(.*)$ ${tolowercase:$1}
Will work, however all file names must then be lowercase.

Also, adding to the end of the line which you've already got [NC] should work.
Use of the [NC] flag causes the RewriteRule to be matched in a case-insensitive manner. That is, it doesn't care whether letters appear as upper-case or lower-case in the matched URI.

In the example below, any request for an image file will be proxied to your dedicated image server. The match is case-insensitive, so that .jpg and .JPG files are both acceptable, for example.

RewriteRule (.*\.(jpg|gif|png))$ http://images.example.com$1 [P,NC]
The P in the above, is to run it through the proxy for the images.example.com websites, ignore the P. That is quoted from http://httpd.apache.org/docs/2.4/rewrite/flags.html