.htaccess 遇到RewriteCond后,htaccess测试停止

.htaccess 遇到RewriteCond后,htaccess测试停止,.htaccess,redirect,drupal,.htaccess,Redirect,Drupal,我想改变所有的方向http://www.mywebsite.com/other/sub/paths 到http://mywebsite.com/other/sub/paths 我正在使用查看我的htaccess url输出,然后再在live站点上执行它。我可以重定向页面,但测试中途停止,并显示以下内容: RewriteCond %{HTTP_HOST} ^www\.mywebsite\.com$ [NC] This condition was met RewriteRule ^(.*)$ ht

我想改变所有的方向http://www.mywebsite.com/other/sub/paths 到http://mywebsite.com/other/sub/paths

我正在使用查看我的htaccess url输出,然后再在live站点上执行它。我可以重定向页面,但测试中途停止,并显示以下内容:

RewriteCond %{HTTP_HOST} ^www\.mywebsite\.com$ [NC]  This condition was met
RewriteRule ^(.*)$ http://mywebsite.com/$1 [L,R=301]
This rule was met, the new url is
http://mywebsite.com/index.php?q=sc?pract?aut The tests are stopped,
using a different host will cause a redirect
停止测试是错误吗? 我有以下几行未经测试,它们是在重写规则之后停止测试的

RewriteCond %{REQUEST_FILENAME} !-f     
RewriteCond %{REQUEST_FILENAME} !-d     
RewriteCond %{REQUEST_URI} !=/favicon.ico   
RewriteRule ^ index.php [L]     
# Requires both mod_rewrite and mod_headers to be enabled.  
# Serve gzip compressed CSS files if they exist and the client accepts gzip.    
RewriteCond %{HTTP:Accept-encoding} gzip    
RewriteCond %{REQUEST_FILENAME}\.gz -s  
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]    
# Serve gzip compressed JS files if they exist and the client accepts gzip.     
RewriteCond %{HTTP:Accept-encoding} gzip    
RewriteCond %{REQUEST_FILENAME}\.gz -s  
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]  
#Serve correct content types, and prevent mod_deflate double gzip.  
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]   
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
如果有任何帮助,我的网站将托管在drupal 6上。

From


[L]标志导致mod_rewrite停止处理规则集。在大多数上下文中,这意味着如果规则匹配,则不会处理进一步的规则。这与Perl中的最后一个命令或C中的break命令相对应。使用此标志指示应立即应用当前规则,而不考虑进一步的规则。

因此,不测试其余代码是否有害?它会不会在我的网站上导致任何不易检测的错误?如果第一条规则不匹配,mod_rewrite将检查下一条规则。因此,如果301重定向发生,则不再进行处理。但是,如果301重定向没有发生,则会检查其他规则。所以他们应该接受测试。测试方法是使用mywebsite.com主机名,而不使用www。。我觉得这些规则还可以。