Rewrites для SocialEngine

Anton Koldaev koldaevav на gmail.com
Пт Янв 14 16:26:52 MSK 2011


Привет
Прошу помощи в написании реврайтов для SocialEngine с Apache2+mod_rewrite на
nginx_0.7.67+php-fpm
Два .htacess.
Первый корневой $DOCROOT/.htaccess:

  # Get rid of index.php
  RewriteCond %{REQUEST_URI} /index\.php
  RewriteRule (.*) index.php?rewrite=2 [L,QSA]
  # Rewrite all directory-looking urls
  RewriteCond %{REQUEST_URI} /$
  RewriteRule (.*) index.php?rewrite=1 [L,QSA]
  # Try to route missing files
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} public\/ [OR]
  RewriteCond %{REQUEST_FILENAME}
\.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
  RewriteRule . - [L]
  # If the file doesn't exist, rewrite to index
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]

Второй $DOCROOT/install/.htaccess:

  # Get rid of index.php
  RewriteCond %{REQUEST_URI} /index\.php
  RewriteRule (.*) index.php?rewrite=2 [L,QSA]
  # Rewrite all directory-looking urls
  RewriteCond %{REQUEST_URI} /$
  RewriteRule (.*) index.php?rewrite=1 [L,QSA]
  # Special cases
  RewriteCond %{REQUEST_URI} static
  # RewriteRule (.*) Boostrap.php [L,QSA]
  RewriteRule (.*) index.php?rewrite=1 [L,QSA]
  # Try to route missing files
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} public\/ [OR]
  RewriteCond %{REQUEST_FILENAME}
\.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
  RewriteRule . - [L]
  # If the file doesn't exist, rewrite to index
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]

Что у меня получается:
# Get rid of index.php
  location /index.php {
    rewrite ^/(.*)$ /index.php?rewrite=2 last;
  }

  # Rewrite all directory-looking urls
  location ~ /$ {
    rewrite ^/(.*)$ /index.php?rewrite=1 last;
  }

  # Try to route missing files
Не знаю, как переписать

  # If the file doesn't exist, rewrite to index
  try_files $uri $uri/ @exist;
  location @exist {
    rewrite ^(.*)$ /index.php?rewrite=1 last;
  }

Получаю либо redirect loop либо 500. Разгребать rewrite-log nginx совместно
с логикой SocialEngine довольно сложно. Прошу помочь для начала переписать
до конца сами правила, возможно внести корректировки в мной написанные.

-- 
Best regards,
Koldaev Anton
----------- следущая часть -----------
Вложение в формате HTML было извлечено…
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20110114/005c20fd/attachment.html>


Подробная информация о списке рассылки nginx-ru