[英]What is the difference in operation between . and ^ and ^(.*)$?
之間的區別是什么?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
和
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
和
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
我知道 ”。” 表示任何字符和字符串開頭的“ ^”。
謝謝您的回復!
首先,讓我們了解目標網頁的匹配方式。
對於着陸頁,URI模式在.htaccess中為^$
,在Apache配置中^/$
。 因此,您可以安全地普遍使用^/?$
。
http://domain.com/
) 。 ^$
URI模式。 http://domain.com
),但具有不必要的捕獲組和冗長的版本,僅^
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.