对于我的问题,我找不到一个直接的答案,需要从真正的专家那里知道。我有一个链接
http://www.example.com/example.html%20text-decoration:%20none%E2%80%9D%3Eexample.com%3C%20%3C/i%3E%3C/span%3E%3Cbr%3E%3Cbr%3E%3Cbr%3E%3Ctable%20bgcolor=2)
http://www.example.com/examindex/?p=2343543我的问题是,如何用.htaccess文件重定向链接301?我想把301个链接1重定向到http://www.example.com/example.html
redirect 301 /example.html%20text-decoration:%20none%E2%80%9D%3Eexample.com%3C%20%3C/i%3E%3C/span%3E%3Cbr%3E%3Cbr%3E%3Cbr%3E%3Ctable%20bgcolor= http://www.example.com/example.html链接2到http://www.example.com/examindex/
redirect 301 /examindex/?p=2343543 http://www.example.com/examindex/但这不管用。有人能帮我吗?非常感谢,
发布于 2015-02-16 10:34:02
您可以在DOCUMENT_ROOT/.htaccess文件中使用以下2条规则:
RewriteEngine On
RewriteRule ^(example\.html)\x20 /$1 [L,NC,R=301]
RewriteCond %{QUERY_STRING} (^|&)p=2343543(&|$) [NC]
RewriteRule ^(examindex)/?$ /$1/? [L,NC,R=301]发布于 2015-02-16 09:58:38
您可以通过以下方式解决问题:
将下面的代码放入.htaccess文件中
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.example.com/$1 [R=301,L]注意:-这种方法只适用于启用Apache重写模块的Linux服务器。
https://stackoverflow.com/questions/28538359
复制相似问题