HTACCESS for 301重定向:
RewriteEngine on
Redirect 301 /page.asp?DH=35 http://www.domain.ch/karriere
HTACCESS代码(稍后在htaccess-File中),用于提供关于永久链接的信息
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
<FilesMatch "\.(htm|php|js|css|htc|png|gif|jpe?g|ico|xml|csv|txt|swf|flv|eot|woff|svg|ttf|pdf|gz)$">
RewriteEngine Off
</FilesMatch>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?catslugs=$0 [QSA,L]
</IfModule>
不幸的是301-Redirekt不起作用。有什么不对,有什么提示吗?
感谢
答案 0 :(得分:1)
QUERY_STRING
指令无法匹配 Redirect
。您需要在mod_rewrite中使用RewriteCond
。这样做:
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} (^|&)DH=35(&|$) [NC]
RewriteRule ^page\.asp$ http://www.domain.ch/karriere? [L,NC,R=301]
<FilesMatch "\.(htm|php|js|css|htc|png|gif|jpe?g|ico|xml|csv|txt|swf|flv|eot|woff|svg|ttf|pdf|gz)$">
RewriteEngine Off
</FilesMatch>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?catslugs=$0 [QSA,L]
</IfModule>