Zeus mod rewrite for WordPress with support for special folders


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. RULE_0_START:
  2. # get the document root
  3. map path into SCRATCH:DOCROOT from /
  4. # initialize our variables
  5. set SCRATCH:ORIG_URL = %{URL}
  6. set SCRATCH:REQUEST_URI = %{URL}
  7.  
  8. # see if theres any queries in our URL
  9. match URL into $ with ^(.*)\?(.*)$
  10. if matched then
  11. set SCRATCH:REQUEST_URI = $1
  12. set SCRATCH:QUERY_STRING = $2
  13. endif
  14. RULE_0_END:
  15.  
  16. RULE_1_START:
  17. # prepare to search for file, rewrite if its not found
  18. set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT}
  19. set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI}
  20.  
  21. # check to see if the file requested is an actual file or
  22. # a directory with possibly an index. don't rewrite if so
  23. look for file at %{SCRATCH:REQUEST_FILENAME}
  24. if not exists then
  25. look for dir at %{SCRATCH:REQUEST_FILENAME}
  26. if not exists then
  27. set SCRATCH:WEBMAIL_URI = %{SCRATCH:ORIG_URL}
  28. match SCRATCH:WEBMAIL_URI into % with ^/webmail
  29. if matched then
  30. goto END
  31. else
  32. set SCRATCH:WEBMAIL_URI = %{SCRATCH:ORIG_URL}
  33. match SCRATCH:WEBMAIL_URI into % with ^/tech_support
  34. if matched then
  35. goto END
  36. else
  37. set SCRATCH:WEBMAIL_URI = %{SCRATCH:ORIG_URL}
  38. match SCRATCH:WEBMAIL_URI into % with ^/controlpanel
  39. if matched then
  40. goto END
  41. else
  42. set URL = /index.php?q=/index.php%{SCRATCH:REQUEST_URI}
  43. goto QSA_RULE_START
  44. endif
  45. endif
  46. endif
  47. endif
  48. endif
  49.  
  50. # if we made it here then its a file or dir and no rewrite
  51. goto END
  52. RULE_1_END:
  53.  
  54. QSA_RULE_START:
  55. # append the query string if there was one originally
  56. # the same as [QSA,L] for apache
  57. match SCRATCH:ORIG_URL into % with \?(.*)$
  58. if matched then
  59. set URL = %{URL}&%{SCRATCH:QUERY_STRING}
  60. endif
  61. goto END
  62. QSA_RULE_END:

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.