To achieve this I had to specify a rule to rewrite all URLs ending in ‘.js/view’:
# Within the .htaccess file: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.+.js)/view$ /utils/codeview.php?loc=/$1 </IfModule>
Behind the scenes, all URLs that fit the schema are rewritten and the ‘codeview.php’ script is requested for each. This script grabs the contents of the JS file (passed as ‘loc’ in the query string) abd runs it through GesHi to get some neat looking syntax highlighting:
So, from now on, if you ever want to have a quick scan through the source of any of my scripts or plugins you can just suffix the location with ‘/view’!