Hej, jestem dość nowy w tej tematyce ale po przejrzeniu dokumentacji przetłumaczyłem Apache`owe reguły rewrite do nginx`owych, prosiłbym jednak o weryfikację.

--> Apache:
  1. # Lines That should already be in your .htacess
  2. <Files "config.php">
  3. Order Allow,Deny
  4. Deny from All
  5. </Files>
  6. <Files "common.php">
  7. Order Allow,Deny
  8. Deny from All
  9. </Files>
  10.  
  11. # You may need to un-comment the following lines
  12. # Options +FollowSymlinks
  13. # To make sure that rewritten dir or file (/|.html) will not load dir.php in case it exist
  14. # Options -MultiViews
  15. # REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE
  16. RewriteEngine On
  17. # Uncomment the statement below if you want to make use of
  18. # HTTP authentication and it does not already work.
  19. # This could be required if you are for example using PHP via Apache CGI.
  20. # RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
  21. # REWRITE BASE
  22. RewriteBase /
  23. # HERE IS A GOOD PLACE TO FORCE CANONICAL DOMAIN
  24. # RewriteCond %{HTTP_HOST} !^podokiem\.pl$ [NC]
  25. # RewriteRule ^(.*)$ <a href="http://podokiem.pl/$1" target="_blank">http://podokiem.pl/$1</a> [QSA,L,R=301]
  26.  
  27. # DO NOT GO FURTHER IF THE REQUESTED FILE / DIR DOES EXISTS
  28. RewriteCond %{REQUEST_FILENAME} -f
  29. RewriteCond %{REQUEST_FILENAME} -d
  30. RewriteRule . - [L]
  31. #####################################################
  32. # PHPBB SEO REWRITE RULES ALL MODES
  33. #####################################################
  34. # AUTHOR : dcz www.phpbb-seo.com
  35. # STARTED : 01/2006
  36. #################################
  37. # FORUMS PAGES
  38. ###############
  39. # FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. "forum" REQUIRES TO BE SET AS FORUM INDEX
  40. # RewriteRule ^forum\.html$ /index.php [QSA,L,NC]
  41. # FORUM ALL MODES
  42. RewriteRule ^(forum|[a-z0-9_-]*-f)([0-9]+)/?(page([0-9]+)\.html)?$ /viewforum.php?f=$2&start=$4 [QSA,L,NC]
  43. # TOPIC WITH VIRTUAL FOLDER ALL MODES
  44. RewriteRule ^(forum|[a-z0-9_-]*-f)([0-9]+)/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?f=$2&t=$4&start=$6 [QSA,L,NC]
  45. # TOPIC WITHOUT FORUM ID & DELIM ALL MODES
  46. RewriteRule ^([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?forum_uri=$1&t=$3&start=$5 [QSA,L,NC]
  47. # PHPBB FILES ALL MODES
  48. RewriteRule ^resources/[a-z0-9_-]+/(thumb/)?([0-9]+)$ /download/file.php?id=$2&t=$1 [QSA,L,NC]
  49. # PROFILES THROUGH USERNAME
  50. RewriteRule ^member/([^/]+)/?$ /memberlist.php?mode=viewprofile&un=$1 [QSA,L,NC]
  51. # USER MESSAGES THROUGH USERNAME
  52. RewriteRule ^member/([^/]+)/(topics|posts)/?(page([0-9]+)\.html)?$ /search.php?author=$1&sr=$2&start=$4 [QSA,L,NC]
  53. # GROUPS ALL MODES
  54. RewriteRule ^(group|[a-z0-9_-]*-g)([0-9]+)(-([0-9]+))?\.html$ /memberlist.php?mode=group&g=$2&start=$4 [QSA,L,NC]
  55. # POST
  56. RewriteRule ^post([0-9]+)\.html$ /viewtopic.php?p=$1 [QSA,L,NC]
  57. # ACTIVE TOPICS
  58. RewriteRule ^active-topics(-([0-9]+))?\.html$ /search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]
  59. # UNANSWERED TOPICS
  60. RewriteRule ^unanswered(-([0-9]+))?\.html$ /search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]
  61. # NEW POSTS
  62. RewriteRule ^newposts(-([0-9]+))?\.html$ /search.php?search_id=newposts&start=$2&sr=topics [QSA,L,NC]
  63. # UNREAD POSTS
  64. RewriteRule ^unreadposts(-([0-9]+))?\.html$ /search.php?search_id=unreadposts&start=$2 [QSA,L,NC]
  65. # THE TEAM
  66. RewriteRule ^the-team\.html$ /memberlist.php?mode=leaders [QSA,L,NC]
  67. # HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES
  68.  
  69. #####################################################
  70. # GYM Sitemaps & RSS
  71. # Global channels
  72. RewriteRule ^rss(/(news)+)?(/(digest)+)?(/(short|long)+)?/?$ /gymrss.php?channels&$2&$4&$6 [QSA,L,NC]
  73. # HTML Global news & maps
  74. RewriteRule ^(news|maps)/?(page([0-9]+)\.html)?$ /map.php?$1&start=$3 [QSA,L,NC]
  75. # END GYM Sitemaps & RSS
  76. #####################################################
  77.  
  78. # FORUM WITHOUT ID & DELIM ALL MODES
  79. # THESE THREE LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY
  80. RewriteCond %{REQUEST_FILENAME} !-f
  81. RewriteCond %{REQUEST_FILENAME} !-d
  82. RewriteRule ^([a-z0-9_-]+)/?(page([0-9]+)\.html)?$ /viewforum.php?forum_uri=$1&start=$3 [QSA,L,NC]
  83. # FIX RELATIVE PATHS : FILES
  84. RewriteRule ^.+/(style\.php|ucp\.php|mcp\.php|faq\.php|download/file.php)$ /$1 [QSA,L,NC,R=301]
  85. # FIX RELATIVE PATHS : IMAGES
  86. RewriteRule ^.+/(styles/.*|images/.*)/$ /$1 [QSA,L,NC,R=301]
  87. # END PHPBB PAGES
  88. #####################################################
  89.  
  90. #####################################################
  91. # GYM Sitemaps & RSS
  92. # HTML Module additional modes
  93. RewriteRule ^(news|maps)/([a-z0-9_-]+)(/([a-z0-9_-]+))?/?(page([0-9]+)\.html)?$ /map.php?$2=$4&$1&start=$6 [QSA,L,NC]
  94. # Main feeds & channels
  95. RewriteRule ^rss(/(news)+)?(/(digest)+)?(/(short|long)+)?(/([a-z0-9_-]+))?/([a-z0-9_]+)\.xml(\.gz)?$ /gymrss.php?$9=$8&$2&$4&$6&gzip=$10 [QSA,L,NC]
  96. # Module feeds
  97. RewriteRule ^[a-z0-9_-]*-[a-z]{1,2}([0-9]+)(/(news)+)?(/(digest)+)?(/(short|long)+)?/([a-z0-9_]+)\.xml(\.gz)?$ /gymrss.php?$8=$1&$3&$5&$7&gzip=$9 [QSA,L,NC]
  98. # Module feeds without ids
  99. RewriteRule ^([a-z0-9_-]+)(/(news)+)?(/(digest)+)?(/(short|long)+)?/([a-z0-9_]+)\.xml(\.gz)?$ /gymrss.php?nametoid=$1&$3&$5&$7&modulename=$8&gzip=$9 [QSA,L,NC]
  100. # Google SitemapIndex
  101. RewriteRule ^sitemapindex\.xml(\.gz)?$ /sitemap.php?gzip=$1 [QSA,L,NC]
  102. # Module cat sitemaps
  103. RewriteRule ^[a-z0-9_-]+-([a-z]{1,2})([0-9]+)\.xml(\.gz)?$ /sitemap.php?module_sep=$1&module_sub=$2&gzip=$3 [QSA,L,NC]
  104. # Module sitemaps
  105. RewriteRule ^([a-z0-9_]+)-([a-z0-9_-]+)\.xml(\.gz)?$ /sitemap.php?$1=$2&gzip=$3 [QSA,L,NC]
  106. # END GYM Sitemaps & RSS
  107. #####################################################



--> nginx (z pominięciem komentarzy oraz pierwszych 10 wierszy):
  1. if (-f $request_filename){
  2. set $rule_0 1$rule_0;
  3. }
  4. if (-d $request_filename){
  5. set $rule_0 2$rule_0;
  6. }
  7. if ($rule_0 = "21"){
  8. #questionmark.gif
  9. }
  10. rewrite ^/(forum|[a-z0-9_-]*-f)([0-9]+)/?(page([0-9]+)\.html)?$ /viewforum.php?f=$2&start=$4 last;
  11. rewrite ^/(forum|[a-z0-9_-]*-f)([0-9]+)/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?f=$2&t=$4&start=$6 last;
  12. rewrite ^/([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?forum_uri=$1&t=$3&start=$5 last;
  13. rewrite ^/resources/[a-z0-9_-]+/(thumb/)?([0-9]+)$ /download/file.php?id=$2&t=$1 last;
  14. rewrite ^/member/([^/]+)/?$ /memberlist.php?mode=viewprofile&un=$1 last;
  15. rewrite ^/member/([^/]+)/(topics|posts)/?(page([0-9]+)\.html)?$ /search.php?author=$1&sr=$2&start=$4 last;
  16. rewrite ^/(group|[a-z0-9_-]*-g)([0-9]+)(-([0-9]+))?\.html$ /memberlist.php?mode=group&g=$2&start=$4 last;
  17. rewrite ^/post([0-9]+)\.html$ /viewtopic.php?p=$1 last;
  18. rewrite ^/active-topics(-([0-9]+))?\.html$ /search.php?search_id=active_topics&start=$2&sr=topics last;
  19. rewrite ^/unanswered(-([0-9]+))?\.html$ /search.php?search_id=unanswered&start=$2&sr=topics last;
  20. rewrite ^/newposts(-([0-9]+))?\.html$ /search.php?search_id=newposts&start=$2&sr=topics last;
  21. rewrite ^/unreadposts(-([0-9]+))?\.html$ /search.php?search_id=unreadposts&start=$2 last;
  22. rewrite ^/the-team\.html$ /memberlist.php?mode=leaders last;
  23. rewrite ^/rss(/(news)+)?(/(digest)+)?(/(short|long)+)?/?$ /gymrss.php?channels&$2&$4&$6 last;
  24. rewrite ^/(news|maps)/?(page([0-9]+)\.html)?$ /map.php?$1&start=$3 last;
  25. if (!-f $request_filename){
  26. set $rule_16 1$rule_16;
  27. }
  28. if (!-d $request_filename){
  29. set $rule_16 2$rule_16;
  30. }
  31. if ($rule_16 = "21"){
  32. rewrite ^/([a-z0-9_-]+)/?(page([0-9]+)\.html)?$ /viewforum.php?forum_uri=$1&start=$3 last;
  33. }
  34. rewrite ^/.+/(style\.php|ucp\.php|mcp\.php|faq\.php|download/file.php)$ /$1 permanent;
  35. rewrite ^/.+/(styles/.*|images/.*)/$ /$1 permanent;
  36. rewrite ^/(news|maps)/([a-z0-9_-]+)(/([a-z0-9_-]+))?/?(page([0-9]+)\.html)?$ /map.php?$2=$4&$1&start=$6 last;
  37. rewrite ^/rss(/(news)+)?(/(digest)+)?(/(short|long)+)?(/([a-z0-9_-]+))?/([a-z0-9_]+)\.xml(\.gz)?$ /gymrss.php?$9=$8&$2&$4&$6&gzip=$10 last;
  38. rewrite ^/[a-z0-9_-]*-[a-z]{1,2}([0-9]+)(/(news)+)?(/(digest)+)?(/(short|long)+)?/([a-z0-9_]+)\.xml(\.gz)?$ /gymrss.php?$8=$1&$3&$5&$7&gzip=$9 last;
  39. rewrite ^/([a-z0-9_-]+)(/(news)+)?(/(digest)+)?(/(short|long)+)?/([a-z0-9_]+)\.xml(\.gz)?$ /gymrss.php?nametoid=$1&$3&$5&$7&modulename=$8&gzip=$9 last;
  40. rewrite ^/sitemapindex\.xml(\.gz)?$ /sitemap.php?gzip=$1 last;
  41. rewrite ^/[a-z0-9_-]+-([a-z]{1,2})([0-9]+)\.xml(\.gz)?$ /sitemap.php?module_sep=$1&module_sub=$2&gzip=$3 last;
  42. rewrite ^/([a-z0-9_]+)-([a-z0-9_-]+)\.xml(\.gz)?$ /sitemap.php?$1=$2&gzip=$3 last;