Welcome! Log In Create A New Profile

Advanced

Rewrites для SocialEngine

Anton Koldaev
January 14, 2011 08:28AM
Привет
Прошу помощи в написании реврайтов для 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
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Rewrites для SocialEngine

Anton Koldaev January 14, 2011 08:28AM

Re: Rewrites для SocialEngine

vt January 14, 2011 05:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 153
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready