我到處看看網上的教程htaccess的都是非常基本的。他們沒有解釋什麼從哪裏獲得advenaced htaccess的turorials
RewriteCond %{HTTP_HOST} ^www\.mysite\.com$ [NC]
RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]
[NC]
和[R=301,L]
平均(我可以計算的301 REDIR壽)
而且哪裏的%{HTTP_HOST}
令牌進來嗎?還有其他什麼?什麼時候捕獲了$1
? ...
是否有解釋這一切的任何教程?
編輯:下面是我的mguymon htaccess文件:
Options -Indexes
ErrorDocument 404 /404.php
CheckSpelling on
RewriteEngine On
RewriteBase/
###### Check for alias module to be installed ######
###### Domain without www ######
RewriteCond %{HTTP_HOST} ^www\.mysite\.com$ [NC]
RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]
###### End www rewrite section ######
# Remove multiple slashes anywhere in URL
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
# Remove multiple slashes after domain
RewriteCond %{HTTP_HOST} !=""
RewriteCond %{THE_REQUEST} ^[A-Z]+\s//+(.*)\sHTTP/[0-9.]+$
RewriteRule .* http://%{HTTP_HOST}/%1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
# show mysite.com/index.php always as mysite.com/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://mysite.com/ [R=301,L]
這將改變www.mysite.com/index.php/////index.php
到mysite.com
這是每一個與他們[L]
開關
教程不是參考。 http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html – 2012-03-20 01:24:07