Advertisement
Guest User

nginx rules for PHP-Script

a guest
Aug 11th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 9.91 KB | None | 0 0
  1. location / {
  2.   if (!-e $request_filename){
  3.     rewrite ^/password-reset/([^\/]+)(\/|)$ /index.php?link1=welcome&link2=password_reset&user_id=$1;
  4.   }
  5.   rewrite ^/$ /index.php?link1=home;
  6.   rewrite "^/forum/members/([a-zA-Z]{0,1})(/?|)$" /index.php?link1=forum-members-byname&char=$1;
  7.   if (!-e $request_filename){
  8.     rewrite ^/setting/([A-Za-z0-9_]+)/([A-Za-z0-9_-]+)$ /index.php?link1=setting&user=$1&page=$2;
  9.     rewrite ^/setting/([A-Za-z0-9_-]+)$ /index.php?link1=setting&page=$1;
  10.     rewrite ^/setting$ /index.php?link1=setting;
  11.   }
  12.   if (!-e $request_filename){
  13.     rewrite ^/@([^\/]+)(\/|)$ /index.php?link1=timeline&u=$1;
  14.   }
  15.   if (!-e $request_filename){
  16.     rewrite ^/([A-Za-z0-9_]+)/([^\/]+)(\/|)$ /index.php?link1=timeline&u=$1&type=$2;
  17.   }
  18.   if (!-e $request_filename){
  19.     rewrite ^/([^\/]+)(\/|)$ /index.php?link1=timeline&u=$1;
  20.   }
  21. }
  22.  
  23. location /admin {
  24.   rewrite ^/admin-cp$ /admincp.php;
  25.   rewrite ^/admin-cp/(.*)$ /admincp.php?page=$1;
  26.   rewrite ^/admin/ads/edit/(\d+)(/?|)$ /index.php?link1=manage-ads&id=$1;
  27. }
  28.  
  29. location = /admincp {
  30.   rewrite ^(.*)$ /admincp.php;
  31. }
  32.  
  33. location /admincp {
  34.   rewrite ^/admincp/(.*)$ /admincp.php?page=$1;
  35. }
  36.  
  37. location /adminPages/ {
  38.   return 301 /admin-panel/;
  39. }
  40.  
  41. location ~ ^/adminPages/(.*) {
  42.     return 301 /admin-panel/$1;
  43. }
  44.  
  45. location /start {
  46.   rewrite ^/start-up$ /index.php?link1=start-up;
  47. }
  48.  
  49. location /saved {
  50.   rewrite ^/saved-posts/(.*)$ /index.php?link1=saved-posts;
  51.   rewrite ^/saved-posts$ /index.php?link1=saved-posts;
  52. }
  53.  
  54. location /activated {
  55.   rewrite ^/activated/(.*)$ /index.php?link1=activate&link2=$1;
  56. }
  57.  
  58. location = /search {
  59.   rewrite ^(.*)$ /index.php?link1=search;
  60. }
  61.  
  62. location /ads {
  63.   rewrite ^/ads-create$ /index.php?link1=ads-create;
  64.   rewrite ^/ads(/?|)$ /index.php?link1=ads;
  65.   rewrite ^/ads/create(/?|)$ /index.php?link1=create-ads;
  66.   rewrite ^/ads/edit/(\d+)(/?|)$ /index.php?link1=edit-ads&id=$1;
  67.   rewrite ^/ads/chart/(\d+)(/?|)$ /index.php?link1=chart-ads&id=$1;
  68. }
  69.  
  70. location /send_money {
  71.   rewrite ^/send_money$ /index.php?link1=ads-create;
  72. }
  73.  
  74. location = /most_liked {
  75.   rewrite ^(.*)$ /index.php?link1=most_liked;
  76. }
  77.  
  78. location /suggested {
  79.   rewrite ^/suggested-pages(/?|)$ /index.php?link1=suggested-pages;
  80.   rewrite ^/suggested-groups(/?|)$ /index.php?link1=suggested-groups;
  81. }
  82.  
  83. location = /poke {
  84.   rewrite ^(.*)$ /index.php?link1=poke;
  85. }
  86.  
  87. location /search {
  88.   rewrite ^/search/([^\/]+)(\/|)$ /index.php?link1=search&query=$1;
  89. }
  90.  
  91. location /app {
  92.   rewrite ^/app/([^\/]+)(\/|)$ /index.php?link1=app&app_id=$1;
  93. }
  94.  
  95. location /messages {
  96.   rewrite ^/messages/([^\/]+)(\/|)$ /index.php?link1=messages&user=$1;
  97. }
  98.  
  99. location /terms {
  100.   rewrite ^/terms/([^\/]+)(\/|)$ /index.php?link1=terms&type=$1;
  101. }
  102.  
  103. location /video {
  104.   rewrite ^/video-call/([^\/]+)(\/|)$ /index.php?link1=video-call&call_id=$1;
  105.   rewrite ^/video-call-api/([^\/]+)(\/|)$ /index.php?link1=video-call-api&call_id=$1;
  106. }
  107.  
  108. location /post {
  109.   rewrite ^/post/([^\/]+)(\/|)$ /index.php?link1=post&id=$1;
  110. }
  111.  
  112. location /game {
  113.   rewrite ^/game/([^\/]+)(\/|)$ /index.php?link1=game&id=$1;
  114. }
  115.  
  116. location = /upgraded {
  117.   rewrite ^(.*)$ /index.php?link1=upgraded;
  118. }
  119.  
  120. location = /get_news_feed {
  121.   rewrite ^(.*)$ /index.php?link1=get_news_feed;
  122. }
  123.  
  124. location = /games {
  125.   rewrite ^(.*)$ /index.php?link1=games;
  126. }
  127.  
  128. location /new {
  129.   rewrite ^/new-game$ /index.php?link1=new-game;
  130.   rewrite ^/new-product$ /index.php?link1=new-product;
  131. }
  132.  
  133. location /go {
  134.   rewrite ^/go-pro$ /index.php?link1=go-pro;
  135. }
  136.  
  137. location = /oops {
  138.   rewrite ^(.*)$ /index.php?link1=oops;
  139. }
  140.  
  141. location /user {
  142.   rewrite ^/user-activation$ /index.php?link1=user-activation;
  143. }
  144.  
  145. location /hashtag {
  146.   rewrite ^/hashtag/([^\/]+)(\/|)$ /index.php?link1=hashtag&hash=$1;
  147. }
  148.  
  149. location /follow {
  150.   rewrite ^/follow-requests/(.*)$ /index.php?link1=follow-requests;
  151. }
  152.  
  153. location = /home {
  154.   rewrite ^(.*)$ /index.php?link1=home;
  155. }
  156.  
  157. location = /404 {
  158.   rewrite ^(.*)$ /index.php?link1=404;
  159. }
  160.  
  161. location /welcome {
  162.   rewrite ^/welcome(.*)$ /index.php?link1=welcome;
  163. }
  164.  
  165. location = /register {
  166.   rewrite ^(.*)$ /index.php?link1=register;
  167. }
  168.  
  169. location /confirm {
  170.   rewrite ^/confirm-sms$ /index.php?link1=confirm-sms;
  171.   rewrite ^/confirm-sms-password(/?|)$ /index.php?link1=confirm-sms-password break;
  172. }
  173.  
  174. location /forgot {
  175.   rewrite ^/forgot-password$ /index.php?link1=forgot-password;
  176. }
  177.  
  178. location = /activate {
  179.   rewrite ^(.*)$ /index.php?link1=activate;
  180. }
  181.  
  182. location = /pages {
  183.   rewrite ^(.*)$ /index.php?link1=pages;
  184. }
  185.  
  186. location = /groups {
  187.   rewrite ^(.*)$ /index.php?link1=groups;
  188. }
  189.  
  190. location /create {
  191.   rewrite ^/create-group$ /index.php?link1=create-group;
  192.   rewrite ^/create-page$ /index.php?link1=create-page;
  193.   rewrite ^/create-album$ /index.php?link1=create-album;
  194.   rewrite ^/create-album/([A-Za-z0-9_-]+)$ /index.php?link1=create-album&album=$1;
  195.   rewrite ^/create-blog(/?|)$ /index.php?link1=create-blog;
  196.   rewrite ^/create-app$ /index.php?link1=create-app;
  197. }
  198.  
  199. location = /logout {
  200.   rewrite ^(.*)$ /index.php?link1=logout;
  201. }
  202.  
  203. location /contact {
  204.   rewrite ^/contact-us$ /index.php?link1=contact-us;
  205. }
  206.  
  207. location = /messages {
  208.   rewrite ^(.*)$ /index.php?link1=messages;
  209. }
  210.  
  211. location = /albums {
  212.   rewrite ^(.*)$ /index.php?link1=albums;
  213. }
  214.  
  215. location /albums {
  216.   rewrite ^/albums/([A-Za-z0-9_-]+)$ /index.php?link1=albums&user=$1;
  217. }
  218.  
  219. location /album {
  220.   rewrite ^/album/([A-Za-z0-9_-]+)$ /index.php?link1=album&id=$1;
  221. }
  222.  
  223. location /page {
  224.   rewrite ^/page-setting/([^\/]+)(\/|)$ /index.php?link1=page-setting&page=$1;
  225.   rewrite ^/page-setting/([A-Za-z0-9_]+)/([A-Za-z0-9_-]+)$ /index.php?link1=page-setting&page=$1&link3=$2;
  226. }
  227.  
  228. location /group {
  229.   rewrite ^/group-setting/([^\/]+)(\/|)$ /index.php?link1=group-setting&group=$1;
  230.   rewrite ^/group-setting/([A-Za-z0-9_]+)/([A-Za-z0-9_-]+)$ /index.php?link1=group-setting&group=$1&link3=$2;
  231. }
  232.  
  233. location /edit {
  234.   rewrite ^/edit-product/([A-Za-z0-9_]+)$ /index.php?link1=edit-product&id=$1;
  235.   rewrite ^/edit-blog/(\d+)(/?|)$ /index.php?link1=edit-blog&id=$1;
  236. }
  237.  
  238. location = /products {
  239.   rewrite ^(.*)$ /index.php?link1=products;
  240. }
  241.  
  242. location /products {
  243.   rewrite ^/products/([A-Za-z0-9_-]+)$ /index.php?link1=products&c_id=$1;
  244. }
  245.  
  246. location /my {
  247.   rewrite ^/my-products$ /index.php?link1=my-products;
  248.   rewrite ^/my-blogs(/?|)$ /index.php?link1=my-blogs;
  249. }
  250.  
  251. location /site {
  252.   rewrite ^/site-pages/(.*)$ /index.php?link1=site-pages&page_name=$1;
  253. }
  254.  
  255. location = /blogs {
  256.   rewrite ^(.*)$ /index.php?link1=blogs;
  257. }
  258.  
  259. location = /sharer {
  260.   rewrite ^(.*)$ /index.php?link1=sharer;
  261. }
  262.  
  263. location /blog {
  264.   rewrite ^/blog-category/(\d+)(/?|)$ /index.php?link1=blog-category&id=$1;
  265. }
  266.  
  267. location /read {
  268.   rewrite ^/read-blog/(.*)$ /index.php?link1=read-blog&id=$1;
  269. }
  270.  
  271. location = /app_api {
  272.   rewrite ^(.*)$ /index.php?link1=app_api;
  273. }
  274.  
  275. location /api {
  276.   rewrite ^/api(/?|)$ /api-v2.php;
  277.   rewrite ^/api/([^\/]+)(\/|)$ /api-v2.php?type=$1;
  278. }
  279.  
  280. location = /authorize {
  281.   rewrite ^(.*)$ /index.php?link1=authorize;
  282. }
  283.  
  284. location /forum {
  285.   rewrite ^/forum(/?|)$ /index.php?link1=forum;
  286.   rewrite ^/forum/members(/?|)$ /index.php?link1=forum-members;
  287.   rewrite ^/forum/search(/?|)$ /index.php?link1=forum-search;
  288.   rewrite ^/forum/search-result/(/?|)$ /index.php?link1=forum-search-result;
  289.   rewrite ^/forum/events(/?|)$ /index.php?link1=forum-events;
  290.   rewrite ^/forum/help(/?|)$ /index.php?link1=forum-help;
  291. }
  292.  
  293. location /forums {
  294.   rewrite ^/forums/(\d+)(/?|)$ /index.php?link1=forums&fid=$1;
  295.   rewrite ^/forums/add/(\d+)(/?|)$ /index.php?link1=forumaddthred&fid=$1;
  296.   rewrite ^/forums/thread/(\d+)(/?|)$ /index.php?link1=showthread&tid=$1;
  297.   rewrite ^/forums/thread/reply/(\d+)(/?|)$ /index.php?link1=threadreply&tid=$1;
  298.   rewrite ^/forums/thread/quote/(\d+)(/?|)$ /index.php?link1=threadquote&tid=$1;
  299.   rewrite ^/forums/thread/edit/(\d+)(/?|)$ /index.php?link1=editreply&tid=$1;
  300.   rewrite ^/forums/user/threads(/?|)$ /index.php?link1=mythreads;
  301.   rewrite ^/forums/user/threads/edit/(\d+)(/?|)$ /index.php?link1=edithread&tid=$1;
  302.   rewrite ^/forums/user/messages(/?|)$ /index.php?link1=mymessages;
  303. }
  304.  
  305. location /events {
  306.   rewrite ^/events(/?|)$ /index.php?link1=events;
  307.   rewrite ^/events/create-event(/?|)$ /index.php?link1=create-event;
  308.   rewrite ^/events/edit/(\d+)/(/?|)$ /index.php?link1=edit-event&eid=$1;
  309.   rewrite ^/events/my(/?|)$ /index.php?link1=my-events;
  310.   rewrite ^/events/going(/?|)$ /index.php?link1=events-going;
  311.   rewrite ^/events/invited(/?|)$ /index.php?link1=events-invited;
  312.   rewrite ^/events/interested(/?|)$ /index.php?link1=events-interested;
  313.   rewrite ^/events/past(/?|)$ /index.php?link1=events-past;
  314.   rewrite ^/events/(\d+)(/?|)$ /index.php?link1=show-event&eid=$1;
  315. }
  316.  
  317. location /unusual {
  318.   rewrite ^/unusual-login$ /index.php?link1=unusual-login;
  319. }
  320.  
  321. location /movies {
  322.   rewrite ^/movies(/?|)$ /index.php?link1=movies;
  323.   rewrite ^/movies/genre/([A-Za-z-]+)(/?|)$ /index.php?link1=movies-genre&genre=$1;
  324.   rewrite ^/movies/country/([A-Za-z-]+)(/?|)$ /index.php?link1=movies-country&country=$1;
  325.   rewrite ^/movies/watch/(\d+)(/?|)$ /index.php?link1=watch-film&film-id=$1;
  326. }
  327.  
  328. location /wallet {
  329.   rewrite ^/wallet(/?|)$ /index.php?link1=wallet;
  330. }
  331.  
  332. location /status {
  333.   rewrite ^/status/create(/?|)$ /index.php?link1=create-status;
  334. }
  335.  
  336. location /more {
  337.   rewrite ^/more-status(/?|)$ /index.php?link1=more-status;
  338. }
  339.  
  340. location /friends {
  341.   rewrite ^/friends-nearby(/?|)$ /index.php?link1=friends-nearby;
  342. }
  343.  
  344. location /_ {
  345.   rewrite ^/_$ /requests.php;
  346. }
  347.  
  348. location /graph {
  349.   rewrite ^/graph-success$ /index.php?link1=graph-success;
  350. }
  351.  
  352. location = /developers {
  353.   rewrite ^(.*)$ /index.php?link1=developers;
  354. }
  355.  
  356. location = /apps {
  357.   rewrite ^(.*)$ /index.php?link1=apps;
  358. }
  359.  
  360. location = /graph {
  361.   rewrite ^(.*)$ /index.php?link1=graph;
  362. }
  363.  
  364. location = /oauth {
  365.   rewrite ^(.*)$ /index.php?link1=oauth;
  366. }
  367.  
  368. location /boosted {
  369.   rewrite ^/boosted-pages$ /index.php?link1=boosted-pages;
  370.   rewrite ^/boosted-posts$ /index.php?link1=boosted-posts;
  371. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement