簡體   English   中英

翻譯apache2重寫規則

[英]translate apache2 rewrite rules

我有這個文件.htaccess為apache:

# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f

# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]

如何將其轉換為Nginx的.htaccess?

我嘗試了這個:

  location / {
    rewrite ^/$ /index.html;
    rewrite / /RewriteRule;
    rewrite ^/(.*)$ /index.php last;
  }

您認為正確嗎?

非常感謝!

您不需要重寫此類內容,只需要try_files即可

try_files /index.html$is_args$args $uri.html$is_args$args $uri /index.php$is_args$args;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM