301重定向,冗余index.php

时间:2013-03-07 16:28:26

标签: php apache .htaccess web http-status-code-301

我有一个问题。我想通过htaccess中的301重定向将我的网站地址从www.lapnet.net.pl重定向到lapnet.net.pl。总是在我尝试使用此代码时:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.lapnet.net.pl
RewriteRule ^(.*)$ http://lapnet.net.pl$1 [R=permanent,L]

浏览器将我重定向到http://lapnet.net.pl/index.php?view= (视图是负责加载内容的变量)。我怎么能避免这个“index.php?view =”? 谢谢你的帮助

1 个答案:

答案 0 :(得分:0)

最后一行看起来很可疑:我会在域后添加/并添加查询字符串,但我不确定这是否是导致问题的原因:

RewriteRule ^(.*)$ http://lapnet.net.pl/$1 [R=301,L,QSA]
                                                    ^^^ add original query string
                                       ^ slash here
相关问题