.htaccess 如何将htaccess转换为NGINX?
请告诉我如何在这个例子中将htaccess转换为NGINX.htaccess 如何将htaccess转换为NGINX?,.htaccess,nginx,.htaccess,Nginx,请告诉我如何在这个例子中将htaccess转换为NGINX <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule \.(js|css|jpeg|jpg|gif|png|ico)(\?|$) - [L,NC,R=404] RewriteCond %{REQUEST_FILENAME} !-f
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(js|css|jpeg|jpg|gif|png|ico)(\?|$) - [L,NC,R=404]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
选项-多视图
重新启动发动机
重写基/
重写cond%{REQUEST_FILENAME}-F
重写规则\(js | css | jpeg | jpg | gif | png | ico)(\?$)-[L,NC,R=404]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
Apache让事情看起来有点复杂。但Nginx中的相同配置非常简单
root /var/www/html;
location ~* \.(js|css|jpeg|jpg|gif|png|ico)(\?|$) {
try_files $uri =404;
}
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php {
# <your fastcgi php handling config>
}
root/var/www/html;
位置*\(js | css | jpeg | jpg | gif | png | ico)(\?|$){
try_files$uri=404;
}
地点/{
尝试_文件$uri$uri//index.php;
}
位置~\.php{
#
}