问题描述
这是一段.htaccess,我想修改成nginx重写规则,我本人对域名重写不了解,希望有朋友能够指点一下,谢谢
RewriteEngine OnRewriteBase /RewriteRule ^index.php$ - [L]# add a trailing slash to /wp-adminRewriteRule ^wp-admin$ wp-admin/ [R=301,L]RewriteCond %{REQUEST_FILENAME} -f [OR]RewriteCond %{REQUEST_FILENAME} -dRewriteRule ^ - [L]RewriteRule ^(wp-(content|admin|includes).*) $1 [L]RewriteRule ^(.*.php)$ $1 [L]RewriteRule . index.php [L]
问题解答
回答1:找到答案了
#ignored: “-” thing used or unknown variable in regex/rewrewrite ^/([_0-9a-zA-Z-]+/)?wp-admin$ /$1wp-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).*) /$2 last;rewrite ^/([_0-9a-zA-Z-]+/)?(.*.php)$ /$2 last;rewrite /. /index.php last;