Template System

Want to complain about something in one of the videos, this is the place.
Post Reply
wrichards8
Posts: 66
Joined: Thu Jan 12, 2012 3:54 pm
Contact:

Template System

Post 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
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: Template System

Post 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
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
Post Reply