好的,感谢卡米尔的帮助和一些反复试验,我找到了答案。这个网站是一个 WordPress 网站。.htaccess 文件按此顺序具有以下内容:
# suExec for PHP
Action application/x-pair-sphp /cgi-bin/php5.cgi
AddType application/x-pair-sphp .php
#Video MIME Types:
AddType video/m4v .m4v
AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /directory/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
redirect 301 /pages/laser.html http://www.joiningtech.com/pages/welding.html
redirect 301 /index_nosound.html http://www.joiningtech.com/
RewriteEngine On
RewriteCond %{REQUEST_URI} =/index.html [NC]
RewriteCond %{QUERY_STRING} =GAW+CAM2&gclid=CNbT06iehLQCFQWe4AodejAAkA [OR]
RewriteCond %{QUERY_STRING} =GAW+CAM2&gclid=CMncjs-ehLQCFdKd4Aod52AAAQ
RewriteRule .* http://www.joiningtech.com/? [L,R=301]
我猜是 WordPress 重写代码和后来的代码有冲突。因此,我将 WordPress 重写代码重新排序到新重定向的下方。
# suExec for PHP
Action application/x-pair-sphp /cgi-bin/php5.cgi
AddType application/x-pair-sphp .php
#Video MIME Types:
AddType video/m4v .m4v
AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm
</IfModule>
redirect 301 /pages/laser.html http://www.joiningtech.com/pages/welding.html
redirect 301 /index_nosound.html http://www.joiningtech.com/
RewriteEngine On
RewriteCond %{REQUEST_URI} =/index.html [NC]
RewriteCond %{QUERY_STRING} =GAW+CAM2&gclid=CNbT06iehLQCFQWe4AodejAAkA [OR]
RewriteCond %{QUERY_STRING} =GAW+CAM2&gclid=CMncjs-ehLQCFdKd4Aod52AAAQ
RewriteRule .* http://www.joiningtech.com/? [L,R=301]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /directory/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
这现在有效。我仍然需要知道是否可以有两个“RewriteEngine On”实例。