RULE_0_START: # set original URL set SCRATCH:ORIGINAL_URL = %{URL} set SCRATCH:REQUEST_URI = %{URL} # Set Root Relative Path set SCRATCH:ROOT_REL = / # don't rewrite certain files match URL into $ with ^/.*\.(gif|jpg|png|css|js).*$ if matched then goto END endif # check for query string and set accordingly match URL into $ with ^(.*)\?(.*)$ if matched then set SCRATCH:QUERY_STRING = $2 set SCRATCH:REQUEST_URI = $1 endif RULE_0_END: RULE_1_START: # prepare to search for file, rewrite if its not found set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT} set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI} # check to see if the file requested is an actual file or # a directory with possibly an index. don't rewrite if so look for file at %{SCRATCH:REQUEST_FILENAME} if not exists then look for dir at %{SCRATCH:REQUEST_FILENAME} if not exists then #remove remove forward slash match SCRATCH:REQUEST_URI into $ with ^/(.*)$ if matched then set SCRATCH:REQUEST_URI = $1 endif #remove .html from the end if it's there. match SCRATCH:REQUEST_URI into $ with ^(.*)\.html$ if matched then set SCRATCH:REQUEST_URI = $1 endif #set BODY = /index.php?seo_path=%{SCRATCH:REQUEST_URI} #goto END set SCRATCH:REQUEST_URI = /index.php?seo_path=%{SCRATCH:REQUEST_URI} goto QSA_RULE_START #goto END endif endif # if we made it here then its a file or dir and no rewrite #set BODY = %{SCRATCH:REQUEST_FILENAME} goto END RULE_1_END: QSA_RULE_START: # append the query string if there was one originally # the same as [QSA,L] for apache match SCRATCH:ORIGINAL_URL into % with \?(.*)$ if matched then #set BODY = %{SCRATCH:REQUEST_URI}&%{SCRATCH:QUERY_STRING} set URL = %{SCRATCH:REQUEST_URI}&%{SCRATCH:QUERY_STRING} else #set BODY = %{SCRATCH:REQUEST_URI} set URL = %{SCRATCH:REQUEST_URI} endif goto END QSA_RULE_END: