/ / Apache .htaccess in Nginx konvertieren - Apache, .htaccess, nginx, neu schreiben

Konvertieren Sie Apache .htaccess in Nginx - Apache, .htaccess, nginx, umschreiben

Ich habe Folgendes bekommen.Htaccess-Code für ein Magento-Plugin, könnte mir jemand helfen, es in gültige Nginx-Umschreibungen zu konvertieren? Ich habe es wirklich schwer, das Problem zu beheben. Es ist ein Plugin, das Magento-URLs neu schreibt und zwischenspeichert.

Der ursprüngliche Editor des Moduls konnte mir nicht helfen. Ich bin mir sicher, dass es viele Leute gibt, die Nginx benutzen und diese Plugins-Funktionalität nutzen wollen!

# static rewrite - home page
RewriteCond %{HTTP_COOKIE} store=default
RewriteCond %{HTTP_COOKIE} !artio_mturbo=.*
RewriteCond %{REQUEST_URI} ^/magento/$
RewriteCond %{QUERY_STRING} !.+
RewriteCond /var/ww/var/turbocache/default.html -f
RewriteRule .* var/turbocache/default.html [L]

# static rewrite - other pages
RewriteCond %{HTTP_COOKIE} store=default
RewriteCond %{HTTP_COOKIE} !artio_mturbo=.*
RewriteCond %{REQUEST_URI} /magento/(.*).html$ [NC]
RewriteCond %{QUERY_STRING} !.+
RewriteCond /var/www/var/turbocache/magento/default/%1.html -f
RewriteRule .* var/turbocache/magento/default/%1.html [L]

# store view is choosen by request_path

# static rewrite - home page

RewriteCond %{HTTP_COOKIE} !artio_mturbo=.*
RewriteCond %{REQUEST_URI} ^/magento/default(/|)$
RewriteCond %{QUERY_STRING} !.+
RewriteCond /var/www/var/turbocache/default.html -f
RewriteRule .* var/turbocache/default.html [L]

# static rewrite - other pages
RewriteCond %{HTTP_COOKIE} !artio_mturbo=.*
RewriteCond %{REQUEST_URI} ^/magento/default/(.*).html$ [NC]
RewriteCond %{QUERY_STRING} !.+
RewriteCond /var/www/var/turbocache/magento/default/%1.html -f
RewriteRule .* var/turbocache/magento/default/%1.html [L]

#cookie
RewriteCond %{HTTP_COOKIE} !artio_mturbo=.*
RewriteCond %{REQUEST_URI} ^/magento/$
RewriteCond %{QUERY_STRING} !.+
RewriteCond /var/www/var/turbocache/default.html -f
RewriteRule .* var/turbocache/default.html [L]

# rules for default storeview

# static rewrite - home page

RewriteCond %{HTTP_COOKIE} !artio_mturbo=.*
RewriteCond %{REQUEST_URI} /magento/(.*).html$ [NC]
RewriteCond %{QUERY_STRING} !.+
RewriteCond /var/www/var/turbocache/magento/default/%1.html -f
RewriteRule .* var/turbocache/magento/default/%1.html [L]

Danke bis jetzt!

Antworten:

3 für die Antwort № 1
if ($http_cookie ~ "store=default"){
set $rule_0 1$rule_0;
}
if ($http_cookie !~ "artio_mturbo=.*"){
set $rule_0 2$rule_0;
}
if ($uri ~ "^/magento/$"){
set $rule_0 3$rule_0;
}
if ($args !~ ".+"){
set $rule_0 4$rule_0;
}
if (-f /var/ww/var/turbocache/default.html){
set $rule_0 5$rule_0;
}
if ($rule_0 = "54321"){
rewrite /.* /var/turbocache/default.html last;
}
if ($http_cookie ~ "store=default"){
set $rule_1 1$rule_1;
}
if ($http_cookie !~ "artio_mturbo=.*"){
set $rule_1 2$rule_1;
}
if ($uri ~* "/magento/(.*).html$"){
set $rule_1 3$rule_1;
}
if ($args !~ ".+"){
set $rule_1 4$rule_1;
}
if (-f /var/www/var/turbocache/magento/default/%1.html){
set $rule_1 5$rule_1;
set $bref_1 $1;
}
if ($rule_1 = "54321"){
rewrite /.* /var/turbocache/magento/default/$bref_1.html last;
}
if ($http_cookie !~ "artio_mturbo=.*"){
set $rule_2 1$rule_2;
}
if ($uri ~ "^/magento/default(/|)$"){
set $rule_2 2$rule_2;
}
if ($args !~ ".+"){
set $rule_2 3$rule_2;
}
if (-f /var/www/var/turbocache/default.html){
set $rule_2 4$rule_2;
}
if ($rule_2 = "4321"){
rewrite /.* /var/turbocache/default.html last;
}
if ($http_cookie !~ "artio_mturbo=.*"){
set $rule_3 1$rule_3;
}
if ($uri ~* "^/magento/default/(.*).html$"){
set $rule_3 2$rule_3;
}
if ($args !~ ".+"){
set $rule_3 3$rule_3;
}
if (-f /var/www/var/turbocache/magento/default/%1.html){
set $rule_3 4$rule_3;
set $bref_1 $1;
}
if ($rule_3 = "4321"){
rewrite /.* /var/turbocache/magento/default/$bref_1.html last;
}
if ($http_cookie !~ "artio_mturbo=.*"){
set $rule_4 1$rule_4;
}
if ($uri ~ "^/magento/$"){
set $rule_4 2$rule_4;
}
if ($args !~ ".+"){
set $rule_4 3$rule_4;
}
if (-f /var/www/var/turbocache/default.html){
set $rule_4 4$rule_4;
}
if ($rule_4 = "4321"){
rewrite /.* /var/turbocache/default.html last;
}
if ($http_cookie !~ "artio_mturbo=.*"){
set $rule_5 1$rule_5;
}
if ($uri ~* "/magento/(.*).html$"){
set $rule_5 2$rule_5;
}
if ($args !~ ".+"){
set $rule_5 3$rule_5;
}
if (-f /var/www/var/turbocache/magento/default/%1.html){
set $rule_5 4$rule_5;
set $bref_1 $1;
}
if ($rule_5 = "4321"){
rewrite /.* /var/turbocache/magento/default/$bref_1.html last;
}

Hoffe, es wird funktionieren, viel Glück.


1 für die Antwort № 2

Hier ist ein Konverter das gibt dir das von deinem htaccess. Dies kann Ihnen eine solide Basis geben. Wenn Sie weitere Fragen haben, können Sie sie gerne schreiben.