![htaccess 到 Nginx 重寫規則](https://rvso.com/image/1601180/htaccess%20%E5%88%B0%20Nginx%20%E9%87%8D%E5%AF%AB%E8%A6%8F%E5%89%87.png)
我已將 apache htaccess 規則轉換為 nginx 重寫規則,但它們對我不起作用。
Apache .htaccess 規則
RewriteEngine On
RewriteBase /public/layout/themes/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
#RewriteCond %{REQUEST_URI} !^/bootstrap/
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) bootstrap/$1 [L]
Nginx 規則:
location /public/layout/themes/ {
if (!-e $request_filename){
rewrite ^/public/layout/themes/(.*)$ /public/layout/themes/bootstrap/$1 break;
}
}
誰能檢查一下我在這裡做錯了什麼嗎?
答案1
我猜,你使用線上工具將你的apache規則轉換為nginx。這可能不是正確的方法。我認為,這參考對你有用。