[英]'nginx rewrite' to '.htacces rewrite'
我在正則表達式中非常糟糕,但在服務器配置中最糟糕。 因此,任何幫助都將是有用的。
在nginx-config中有這樣的
location / {
rewrite ^(.*[^/])$ $1/ permanent;
try_files $uri $uri/ /index.php?$args;
}
需要等價的東西。 TY。
他們應該證明非常相似。
<IfModule mod_rewrite.c>
RewriteEngine On
# Your web directory root
RewriteBase /
#Make sure it's not a specific file or directory that they're trying to reach
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*[^/])$ index.php?args=$1 [NC, L]
</IfModule>
這將:
[NC,L]標志分別告訴該規則不區分大小寫,並告訴Apache這是最后一個重定向規則。
我不得不承認,我不確定您的Regex正在測試什么。 您介意解釋要設置的URL方案嗎? 我應該能夠幫助您正確制定正則表達式。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.