Guest User

Untitled

a guest
Dec 1st, 2014
377
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. index index.php index.html index.htm;
  2. autoindex off;
  3. charset utf-8;
  4.  
  5. error_page 404 502 = /404error.php;
  6.  
  7. if ($uri !~ "(.[a-zA-Z0-9]{1,5}|/)$") {
  8. rewrite /(.*)([^/])$ http://$http_host/$1$2/ permanent;
  9. }
  10. if ($http_host !~ "^www.") {
  11. rewrite /.* http://www.$http_host$uri permanent;
  12. }
  13.  
  14.  
  15. location / {
  16.  
  17. if (!-e $request_filename){
  18. ## Re-directing Begin
  19. # Story and Category URLs
  20. rewrite ^/(all)/([^/]+)/?$ /story.php?title=$2 last;
  21. rewrite ^/(all)/?$ index.php last;
  22.  
  23. # /recent redirection
  24. rewrite ^/upcoming/recent/?$ /upcoming permanent;
  25. rewrite ^/upcoming/recent/category/([^/]+)/?$ /upcoming/category/$1 permanent;
  26. rewrite ^/upcoming/recent/page/(\d+)/?$ /upcoming/page/$1 permanent;
  27. rewrite ^/upcoming/recent/category/([^/]+)/page/(\d+)/?$ /upcoming/category/$1/page/$2 permanent;
  28. rewrite ^/recent/?$ /./ permanent;
  29. rewrite ^/recent/category/([^/]+)/?$ /category/$1 permanent;
  30. rewrite ^/recent/page/(\d+)/?$ /page/$1 permanent;
  31. rewrite ^/recent/category/([^/]+)/page/(\d+)/?$ /category/$1/page/$2 permanent;
  32. rewrite ^/upcoming/recent/([^/]+)/?$ /upcoming/category/$1 permanent;
  33. rewrite ^/upcoming/recent/([^/]+)/page/(\d+)/?$ /upcoming/category/$1/page/$2 permanent;
  34. rewrite ^/recent/([^/]+)/?$ /category/$1 permanent;
  35. rewrite ^/recent/([^/]+)/page/(\d+)/?$ /category/$1/page/$2 permanent;
  36. rewrite ^/upcoming/([^/]+)/rss/?$ /rss.php?status=queued&category=$1 last;
  37. rewrite ^/upcoming/rss/?$ /rss.php?status=queued last;
  38. rewrite ^/(\d+)/rss/?$ /storyrss.php?id=$1 last;
  39. rewrite ^/([^/]+)/rss/?$ /rss.php?category=$1 last;
  40. rewrite ^/user/profile/([^/]+)/rss/?$ /userrss.php?user=$1 last;
  41. rewrite ^/user/profile/([^/]+)/rss/([a-zA-Z0-9-]+)/?$ /userrss.php?user=$1&status=$2 last;
  42. rewrite ^/rss/?$ /rss.php last;
  43. rewrite ^/search/([^/]+)/rss/?$ /rss.php?search=$1 last;
  44. rewrite ^/group/([^/]+)/rss/?$ /rss.php?status=published&group=$1 last;
  45. rewrite ^/group/([^/]+)/upcoming/rss/?$ /rss.php?status=queued&group=$1 last;
  46. rewrite ^/group/([^/]+)/shared/rss/?$ /rss.php?status=shared&group=$1 last;
  47. rewrite ^/([^/]+)/([^/]+)/rss/?$ /storyrss.php?title=$2 last;
  48. rewrite ^/rss/([a-zA-Z0-9-]+)/?$ /rss.php?status=$1 last;
  49. rewrite ^/rss/category/([^/]+)/?$ /rss.php?category=$1 last;
  50. rewrite ^/rss/category/upcoming/([^/]+)/?$ /rss.php?status=queued&category=$1 last;
  51. rewrite ^/rss/category/published/([^/]+)/?$ /rss.php?status=published&category=$1 last;
  52. rewrite ^/rss/category/([^/]+)/queued/?$ /rss.php?status=queued&category=$1 last;
  53. rewrite ^/rss/category/([^/]+)/published/?$ /rss.php?status=published&category=$1 last;
  54. rewrite ^/rss/category/([^/]+)/group/([^/]+)/?$ /rss.php?category=$1&group=$2 last;
  55. rewrite ^/rss/category/upcoming/([^/]+)/([^/]+)/?$ /rss.php?status=queued&category=$1&group=$2 last;
  56. rewrite ^/rss/category/published/([^/]+)/([^/]+)/?$ /rss.php?status=published&category=$1&group=$2 last;
  57. rewrite ^/rss/search/([^/]+)/?$ /rss.php?search=$1 last;
  58. rewrite ^/rssfeeds/?$ /rssfeeds.php last;
  59.  
  60. ## URL Method 2 Begin ##
  61.  
  62. rewrite ^/?$ /index.php last;
  63. rewrite ^/advanced-search/?$ /advancedsearch.php last;
  64. rewrite ^/category/([^/]+)/?$ /index.php?category=$1 last;
  65. rewrite ^/category/([^/]+)/([^/]+)/?$ story.php?title=$2 last;
  66. rewrite ^/new/?$ /new.php last;
  67. rewrite ^/new/recent/?$ /new permanent;
  68. rewrite ^/new/recent/category/([^/]+)/?$ /new/category/$1 permanent;
  69. rewrite ^/new/recent/page/(d+)/?$ /new/page/$1 permanent;
  70. rewrite ^/new/recent/category/([^/]+)/page/(d+)/?$ /new/category/$1/page/$2 permanent;
  71. rewrite ^/new/recent/([^/]+)/?$ /new/category/$1 permanent;
  72. rewrite ^/new/recent/([^/]+)/page/(d+)/?$ /new/category/$1/page/$2 permanent;
  73. rewrite ^/new/([^/]+)/rss/?$ /rss.php?status=new&category=$1 last;
  74. rewrite ^/new/rss/?$ /rss.php?status=new last;
  75. rewrite ^/new/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/?$ /new.php?part=$1 last;
  76. rewrite ^/new/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/category/([^/]+)/?$ /new.php?part=$1&category=$2 last;
  77. rewrite ^/new/([^/]+)/?$ /new.php?category=$1 last;
  78. rewrite ^/new/page/([0-9]+)/?$ /new.php?page=$1 last;
  79. rewrite ^/new/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/page/(d+)/?$ /new.php?part=$1&page=$2 last;
  80. rewrite ^/new/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/category/([^/]+)/page/(d+)/?$ /new.php?part=$1&category=$2&page=$3 last;
  81. rewrite ^/user/([^/]+)/profile/?$ /user/$1/ permanent;
  82. rewrite ^/user/([^/]+)/edit/?$ /profile.php?login=$1 last;
  83. rewrite ^/live/new/?$ /live_unpublished.php last;
  84. rewrite ^/live/new/page/([^/]+)/?$ /live_unpublished.php?page=$1 last;
  85. rewrite ^/new/([^/]+)/page/(d+)/?$ /new.php?category=$1&page=$2 last;
  86. rewrite ^/new/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/([^/]+)/?$ /new.php?part=$1&category=$2 last;
  87. rewrite ^/new/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/([^/]+)/page/(d+)/?$ /new.php?part=$1&category=$2&page=$3 last;
  88. rewrite ^/login/?$ /login.php last;
  89. rewrite ^/login/([a-zA-Z0-9-]+)/?$ /login.php?return=$1 last;
  90. rewrite ^/login/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ /login.php?return=$1/$2 last;
  91. rewrite ^/logout/?$ /login.php?op=logout&return=index.php last;
  92. rewrite ^/logout/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ /login.php?op=logout&return=$1/$2 last;
  93. rewrite ^/out/([\d]+)/?$ /out.php?id=$1 last;
  94. rewrite ^/out/(https?:.+)$ /out.php?url=$1 last;
  95. rewrite ^/out/([^/]+)/?$ /out.php?title=$1 last;
  96. rewrite ^/profile/?$ /profile.php last;
  97. rewrite ^/register/?$ /register.php last;
  98. rewrite ^/search/([^/]+)/page/(\d+)/?$ /search.php?search=$1&page=$2 last;
  99. rewrite ^/search/(.+)/?$ /search.php?search=$1 last;
  100. rewrite ^/searchurl/(.+)/?$ /search.php?url=$1 last;
  101. rewrite ^/settemplate/?$ /settemplate.php last;
  102. rewrite ^/story/([0-9]+)/?$ /story.php?id=$1 last;
  103. rewrite ^/story/([^/]+)/?$ /story.php?title=$1 last;
  104. rewrite ^/story/([0-9]+)/editcomment/([0-9]+)/?$ /edit.php?id=$1&commentid=$2 last;
  105. rewrite ^/story/([0-9]+)/edit/?$ /editlink.php?id=$1 last;
  106. rewrite ^/submit/?$ /submit.php last;
  107. rewrite ^/tag/([^/]+)/([^/]+)/?$ /search.php?search=$1&tag=true&from=$2 last;
  108. rewrite ^/tag/([^/]+)/?$ /search.php?search=$1&tag=true last;
  109. rewrite ^/tag/([^/]+)/page/(.+)/?$ /search.php?search=$1&tag=true&page=$2 last;
  110. rewrite ^/tagcloud/?$ /cloud.php last;
  111. rewrite ^/tagcloud/range/([0-9]+)/?$ /cloud.php?range=$1 last;
  112. rewrite ^/topusers/?$ /topusers.php last;
  113. rewrite ^/trackback/([0-9]+)/?$ /trackback.php?id=$1 last;
  114. rewrite ^/upcoming/?$ /upcoming.php last;
  115. rewrite ^/upcoming/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/?$ /upcoming.php?part=$1 last;
  116. rewrite ^/upcoming/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/category/([^/]+)/?$ /upcoming.php?part=$1&category=$2 last;
  117. rewrite ^/upcoming/([^/]+)/?$ /upcoming.php?category=$1 last;
  118. rewrite ^/upcoming/page/([0-9]+)/?$ /upcoming.php?page=$1 last;
  119. rewrite ^/upcoming/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/page/(\d+)/?$ /upcoming.php?part=$1&page=$2 last;
  120. rewrite ^/upcoming/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/category/([^/]+)/page/(\d+)/?$ /upcoming.php?part=$1&category=$2&page=$3 last;
  121. rewrite ^/user/?$ /user.php last;
  122. rewrite ^/user/search/([^/]+)/?$ /user.php?view=search&keyword=$1 last;
  123. rewrite ^/user/profile/([^/]+)/following/?$ /user.php?login=$1&view=following last;
  124. rewrite ^/user/profile/([^/]+)/followers/?$ /user.php?login=$1&view=followers last;
  125. rewrite ^/user/([^/]+)/?$ /user.php?view=$1 last;
  126. rewrite ^/user/([^/]+)/([^/]+)/?$ /user.php?view=$1&login=$2 last;
  127. rewrite ^/user/([^/]+)/link/([0-9+]+)/?$ /user_add_remove_links.php?action=$1&link=$2 last;
  128.  
  129. ## Admin
  130. rewrite ^/admin/?$ /admin/admin_index.php last;
  131. rewrite ^/admin_comments/page/([^/]+)/?$ /admin/admin_comments.php?page=$1 last;
  132. rewrite ^/admin_links/page/([^/]+)/?$ /admin/admin_links.php?page=$1 last;
  133. rewrite ^/admin_users/page/([^/]+)/?$ /admin/admin_users.php?page=$1 last;
  134. rewrite ^/story/([0-9]+)/modify/([a-z]+)/?$ /admin/linkadmin.php?id=$1&action=$2 last;
  135. rewrite ^/view/([^/]+)/?$ /admin/admin_users.php?mode=view&user=$1 last;
  136.  
  137. ## Groups
  138. rewrite ^/join_group/action/(published|queued|discard)/link/(\d+)/?$ /join_group.php?action=$1&link=$2 last;
  139. rewrite ^/groups/?$ /groups.php last;
  140. rewrite ^/groups/search/([^/]+)/?$ /groups.php?view=search&keyword=$1 last;
  141. rewrite ^/groups/submit/?$ /submit_groups.php last;
  142. rewrite ^/groups/(members|name|oldest|newest)/?$ /groups.php?sortby=$1 last;
  143. rewrite ^/groups/([^/]+)/?$ /group_story.php?title=$1 last;
  144. rewrite ^/groups/([^/]+)/page/([0-9]+)/?$ /group_story.php?title=$1&page=$2 last;
  145. rewrite ^/groups/([^/]+)/?$ /group_story.php?title=$1&view=published last;
  146. rewrite ^/groups/([^/]+)/(published|upcoming|shared|members)/?$ /group_story.php?title=$1&view=$2 last;
  147. rewrite ^/groups/([^/]+)/(published|upcoming|shared|members)/page/([0-9]+)/?$ /group_story.php?title=$1&view=$2&page=$3 last;
  148. rewrite ^/groups/([^/]+)/(published|upcoming|shared|members)/category/([^/]+)/?$ /group_story.php?title=$1&view=$2&category=$3 last;
  149. rewrite ^/groups/([^/]+)/(published|upcoming|shared|members)/category/([^/]+)/page/([0-9]+)?$ /group_story.php?title=$1&view=$2&category=$3&page=$4 last;
  150. rewrite ^/groups/delete/([0-9]+)/?$ /deletegroup.php?id=$1 last;
  151. rewrite ^/groups/edit/([0-9]+)/?$ /editgroup.php?id=$1 last;
  152. rewrite ^/groups/id/([0-9]+)/?$ /group_story.php?id=$1 last;
  153. rewrite ^/groups/join/([0-9]+)/? /join_group.php?id=$1&join=true last;
  154. rewrite ^/groups/member/admin/id/([0-9]+)/role/([a-zA-Z0-9_-]+)/userid/([0-9]+)/?$ /groupadmin.php?id=$1&role=admin&userid=$3 last;
  155. rewrite ^/groups/member/normal/id/([0-9]+)/role/([a-zA-Z0-9_-]+)/userid/([0-9]+)/?$ /groupadmin.php?id=$1&role=normal&userid=$3 last;
  156. rewrite ^/groups/member/moderator/([0-9]+)/role/([a-zA-Z0-9_-]+)/userid/([0-9]+)/?$ /groupadmin.php?id=$1&role=$2&userid=$3 last;
  157. rewrite ^/groups/member/flagged/([0-9]+)/role/([a-zA-Z0-9_-]+)/userid/([0-9]+)/?$ /groupadmin.php?id=$1&role=flagged&userid=$3 last;
  158. rewrite ^/groups/member/banned/id/([0-9]+)/role/([a-zA-Z0-9_-]+)/userid/([0-9]+)/?$ /groupadmin.php?id=$1&role=banned&userid=$3 last;
  159. rewrite ^/groups/page/([0-9]+)/?$ /groups.php?page=$1 last;
  160. rewrite ^/groups/unjoin/([0-9]+)/? /join_group.php?id=$1&join=false last;
  161. rewrite ^/groups/withdraw/([0-9]+)/user_id/([0-9]+)/?$ /join_group.php?group_id=$1&user_id=$2&activate=withdraw last;
  162.  
  163. ## Live
  164. rewrite ^/live/?$ /live.php last;
  165. rewrite ^/live/comments/?$ /live_comments.php last;
  166. rewrite ^/live/comments/page/([^/]+)/?$ /live_comments.php?page=$1 last;
  167. rewrite ^/live/published/?$ /live_published.php last;
  168. rewrite ^/live/published/page/([^/]+)/?$ /live_published.php?page=$1 last;
  169. rewrite ^/live/upcoming/?$ /live_unpublished.php last;
  170. rewrite ^/live/upcoming/page/([^/]+)/?$ /live_unpublished.php?page=$1 last;
  171.  
  172. #Modules
  173. rewrite ^/inbox/?$ /module.php?module=simple_messaging&view=inbox last;
  174. rewrite ^/sitemapindex.xml /module.php?module=xml_sitemaps_show_sitemap last;
  175. rewrite ^/sitemap-([a-zA-Z0-9]+).xml /module.php?module=xml_sitemaps_show_sitemap&i=$1 last;
  176. rewrite ^/status/([0-9]+)/?$ /modules/status/status.php?id=$1 last;
  177. rewrite ^/toolbar/(\d+)/?$ /modules/pligg_web_toolbar/toolbar.php?id=$1;
  178. rewrite ^/sitemapindex.xml /module.php?module=xml_sitemaps_show_sitemap last;
  179. rewrite ^/sitemap-([0-9a-z]+).xml /module.php?module=xml_sitemaps_show_sitemap&i=$1 last;
  180.  
  181. ## Pages
  182. rewrite ^/about/?$ /page.php?page=about last;
  183. rewrite ^/static/([^/]+)/?$ /page.php?page=$1 last;
  184.  
  185. ## Pagination
  186. rewrite ^/category/([^/]+)/page/([^/]+)/?$ /index.php?category=$1&page=$2 last;
  187. rewrite ^/page/([^/]+)/?$ /index.php?page=$1 last;
  188. rewrite ^/page/([^/]+)/([^/]+)category/([^/]+)/?$ /index.php?page=$1&part=$2&category=$3 last;
  189. rewrite ^/upcoming/([^/]+)/page/(\d+)/?$ /upcoming.php?category=$1&page=$2 last;
  190. rewrite ^/published/page/([^/]+)/([^/]+)/?$ /index.php?page=$1&category=$2 last;
  191. rewrite ^/published/page/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?page=$1&part=$2&category=$3 last;
  192. rewrite ^/published/page/([^/]+)/?$ /index.php?page=$1 last;
  193. rewrite ^/published/page/([^/]+)/category/([^/]+)/?$ /index.php?page=$1&category=$2 last;
  194. rewrite ^/published/page/([^/]+)/([^/]+)category/([^/]+)/?$ /index.php?page=$1&part=$2&category=$3 last;
  195. rewrite ^/published/page/([^/]+)/([^/]+)/?$ /index.php?page=$1&part=$2 last;
  196. rewrite ^/published/page/([^/]+)/range/([^/]+)/?$ /?page=$1&range=$2 last;
  197. rewrite ^/search/page/([^/]+)/([^/]+)/?$ /search.php?page=$1&search=$2 last;
  198. rewrite ^/topusers/page/([^/]+)/?$ /topusers.php?page=$1 last;
  199. rewrite ^/topusers/page/([^/]+)/sortby/([^/]+)?$ /topusers.php?page=$1&sortby=$2 last;
  200. rewrite ^/user/page/([^/]+)/([^/]+)/([^/]+)/?$ /user.php?page=$1&view=$2&login=$3 last;
  201. rewrite ^/user/([^/]+)/([^/]+)/page/(\d+)/?$ /user.php?page=$3&view=$1&login=$2 last;
  202.  
  203. ## Sort
  204. rewrite ^/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/?$ /index.php?part=$1 last;
  205. rewrite ^/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/category/([^/]+)/?$ /index.php?part=$1&category=$2 last;
  206. rewrite ^/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/page/(\d+)/?$ /index.php?part=$1&page=$2 last;
  207. rewrite ^/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/category/([^/]+)/page/(\d+)/?$ /index.php?part=$1&category=$2&page=$3 last;
  208. rewrite ^/upcoming/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/([^/]+)/?$ /upcoming.php?part=$1&category=$2 last;
  209. rewrite ^/upcoming/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/([^/]+)/page/(\d+)/?$ /upcoming.php?part=$1&category=$2&page=$3 last;
  210. rewrite ^/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/([^/]+)/?$ /index.php?part=$1&category=$2 last;
  211. rewrite ^/(year|month|week|today|yesterday|recent|alltime|upvoted|downvoted|commented)/([^/]+)/page/(\d+)/?$ /index.php?part=$1&category=$2&page=$3 last;
  212.  
  213. ## URL Method 2 End ##
  214. }
  215.  
  216. if (!-e $request_filename){
  217. rewrite ^/([^/]+)/?$ /index.php?category=$1 last;
  218. }
  219. if (!-e $request_filename){
  220. rewrite ^/([^/]+)/page/([^/]+)/?$ /index.php?category=$1&page=$2 last;
  221. }
  222. if (!-e $request_filename){
  223. rewrite ^/([^/]+)/([^/]+)/?$ /story.php?title=$2&category=$1 last;
  224. rewrite ^/([^/]+)/([^/]+)/([0-9]+)/?$ /story.php?title=$2&category=$1&comment_id=$3 last;
  225. rewrite ^/([^/]+)/([^/]+)/reply/([0-9]+)/?$ /story.php?title=$2&category=$1&comment_id=$3&reply=1 last;
  226. }
  227.  
  228. if ($query_string ~* 'mosConfig_[a-zA-Z_]{1,21}(=|\%3D)' ){
  229. return 405;
  230. }
  231. if ($query_string ~* base64_encode.*\(.*\) ){
  232. return 405;
  233. }
  234. if ($query_string ~* (\<|%3C).*script.*(\>|%3E) ){
  235. return 405;
  236. }
  237. if ($query_string ~* 'GLOBALS(=|\[|\%[0-9A-Z]{0,2})' ){
  238. return 405;
  239. }
  240. if ($query_string ~* '_REQUEST(=|\[|\%[0-9A-Z]{0,2})' ){
  241. return 405;
  242. }
  243.  
  244. if ($http_user_agent ~* ^pycurl/){
  245. return 405;
  246. }
  247.  
  248. }
RAW Paste Data