【发布时间】:2014-06-12 09:29:57
【问题描述】:
我想将所有http://www.mywebsite.com/other/sub/paths 重定向到http://mywebsite.com/other/sub/paths
我正在使用http://htaccess.madewithlove.be 来查看我的 htaccess url 输出,然后再在实时站点上进行操作。我可以重定向我的页面,但测试中途停止并显示以下内容:
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
这是测试停止的错误吗? 我有以下几行未经测试(它们在测试停止的 RewriteRules 之后)
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 上。
【问题讨论】: