我有一個與 apache 服務器一起作業的 react 應用程式。這是我的 .htaccess 檔案
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
我想將www.domain.com請求重定向到 domain.com,無論如何我如何使用 htaccess 將請求 www 重定向到非 www ?謝謝!
uj5u.com熱心網友回復:
你可以使用這個:
Options -MultiViews
RewriteEngine On
#www to non-www redirection
RewriteCond %{HTTP_HOST} ^www\.(. )$ [NC]
RewriteRule (.*) https://%1/$1 [NE,L,R=301]
#rewrite non-files to index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/393300.html
