Не буду плодить темы.
есть htaccess:
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /html/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/html/.*$
RewriteRule ^(.*)$ /html/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^html/.*$ /html/index.php [NC,L]
Никак не могу переписать на nginx. Пользовался онлайн конвертором (http://www.anilcetin.com/convert-apache-htaccess-to-nginx/) кое-что перевел, работает но выглядит не очень "красиво". Последние два правила не подобрал.
Вот мой конфиг хоста:
server {
listen 80;
server_name somehost.org www.somehost.org;
access_log /var/log/nginx/somehost.org-access_log main;
error_log /var/log/nginx/somehost.org-error.log;
location / {
root /var/www/html/somehost.org;
index index.html index.htm index.php;
### RewriteCond %{REQUEST_URI} ="" RewriteRule ^.*$ /html/index.php [NC,L] ##
if ($uri ~ ''){
set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
rewrite ^/.*$ /html/index.php last;
}
############################################################################
}
### RewriteCond %{REQUEST_URI} !^/html/.*$ RewriteRule ^(.*)$ /html/$1 #####
if ($uri !~ ^/html/.*$){
set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
rewrite ^/(.*)$ /html/$1 last;
}
################################################################
### RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^.*$ - [NC,L] #######
???
################################################################
### RewriteRule ^html/.*$ /html/index.php [NC,L] ###########################
???
################################################################
location ~ \.php$ {
root /var/www/html/somehost.org;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/somehost.org$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
С регуляркой у меня не очень, спасибо если кто подскажет чего.