符号在htaccess中是做什么的。我从一个在线论坛上捡到了一个htaccess的代码,他们使用这个代码。我想了解这个符号在htaccess中的含义,如果与管道符号x有任何区别的话。
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]发布于 2013-02-11 00:53:40
当然,它不应该在那里,而且可能是因为从一个包含错误符号的源复制和粘贴的结果。
对于RegExp库来说,它只是另一个没有特殊意义的文字字符。它将不会被视为管道符号,也就是说,它将类似于写作。
RewriteRule \.(jpe?gxgifxbmpxpng)$ - [F]这将使这条规则毫无用处。
资料来源:测试了它以确保。
https://stackoverflow.com/questions/14804238
复制相似问题