Rewrite rules

From PlainOldWebserver

Jump to: navigation, search


pow_server.REWRITE_RULES

This array of arrays contains all rules for rewriting incoming paths. They are written as Perl compatible regular expressions. To load these rules, place them in your htdocs/system/startup.sjs file

 // htdocs/system/startup.sjs
 <?sjs
   pow_server.REWRITE_RULES =  
   [
     [ "dog/?(.*)$",        "/cat.sjs?q=$1" ],
     [ /^\/Jason\/?(.*)$/i, "/cat.sjs?q=$1" ]
   ];
 ?>

Result:

 "dog.html"        becomes "/cat.sjs?q=.html"
 "/jaSOn/argonauts becomes "/cat.sjs?q=argonauts"

See Also

Personal tools
Navigation