2013-02-11 69 views
0

符號在htaccess中做了什麼。我從一個在線論壇爲htaccess挑選了一個代碼,他們使用|。我想了解這個符號在htaccess中意味着什麼,如果根本不存在任何差異,htaccess中的符號是什麼以及它的功能

RewriteEngine on 
# 
### Disallow Image Hotlinking 
RewriteCond %{HTTP_REFERER} . 
RewriteCond %{HTTP_REFERER} !^http://www\.example\.net 
RewriteRule \.(jpe?g¦gif¦bmp¦png)$ - [F] 
# 
### Externally redirect to remove ".php" if the user adds it 
RewriteCond %{THE_REQUEST} ^GET\ /([^/]+/)*[^.]+\.php(\?[^\ ]*)?\ HTTP/ 
RewriteRule ^(([^/]+/)*[^.]+)\.php$ http://www.example.net/$1 [R=301,L] 
# 
### Externally redirect to remove double slashes 
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ 
RewriteRule . http://www.example.net/%1/%2 [R=301,L] 
# 
### Externally redirect to remove trailing slash 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.+)/$ http://www.example.net/$1 [R=301,L] 
# 
### Externally redirect non-canonical hostname requests to canonical 
### domain (if not already done by one of the preceding rules) 
RewriteCond %{HTTP_HOST} !=www.example.net 
RewriteRule ^(.*)$ http://www.example.net/$1 [R=301,L] 
# 
### Internally rewrite requests for URLs which do not resolve 
### to physically-existing files or directories to a PHP file 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ $1.php [L,QSA] 

回答

1

這當然是不應該在那裏,大概到了那裏作爲從包括錯誤符號源拷貝粘貼&的結果。

對於RegExp庫,它將只是另一個沒有任何特殊含義的文字字符。它不會像管道符號那樣對待,即它將類似於書寫

RewriteRule \.(jpe?gxgifxbmpxpng)$ - [F] 

它將使規則無用。

來源:經測試確認。

+0

感謝您驗證此信息。 – Solo 2013-02-11 19:45:55

相關問題