url-rewrite - Please tell me how to modify this rewrite into code that nginx can read.
给我你的怀抱
给我你的怀抱 2017-05-16 17:28:16
0
1
906

This is a .htaccess section. I want to change it to nginx rewriting rules. I don’t know much about domain name rewriting. I hope some friends can give me some advice. Thank you

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*)  [L]
RewriteRule ^(.*\.php)$  [L]
RewriteRule . index.php [L]
给我你的怀抱
给我你的怀抱

reply all(1)
刘奇

Found the answer

#ignored: “-” thing used or unknown variable in regex/rew
rewrite ^/([_0-9a-zA-Z-]+/)?wp-admin$ /wp-admin/ permanent;
if (-f $request_filename){
    set $rule_2 1;
}
if (-d $request_filename){
    set $rule_2 1;
}
if ($rule_2 = "1"){
#ignored: “-” thing used or unknown variable in regex/rew
}
rewrite ^/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) / last;
rewrite ^/([_0-9a-zA-Z-]+/)?(.*.php)$ / last;
rewrite /. /index.php last;
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template