2015-11-19 89 views
0

我有一個使用Apache/2.2.15的centos webserver。在過去,我有這樣的登錄頁面http://app.website.com/index.php?resource=Login,現在我改變了我的網站,並且我想將此頁面重定向到新頁面。我在虛擬主機puted此重定向:Apache重定向到一個乾淨的URL

RedirectPermanent/https://newapp.website.com/ 

,現在當我訪問此頁面http://app.website.com/index.php?resource=Login我重定向到http://newapp.website.com/index.php?resource=Login這個頁面,我收到404 但我想我重定向到URL乾淨,沒有「指標.php?resource = Login「只需http://newapp.website.com/。我想解決這個問題,因爲許多用戶爲登錄頁面添加書籤,現在他們收到404錯誤。我不會更改網站,我需要apache或.htaccess中的解決方案。由於

回答

1

重定向指令追加尾隨路徑查詢字符串到其目標地址,嘗試了mod_rewrite來解決這個問題:

RewriteEngine On 

RewriteCond %{THE_REQUEST} /index\.php\?resource=Login [NC] 
RewriteRule^http://newapp.website.com/? [NC,L,R] 

空問號,因爲它會丟棄原來是非常重要的從url中查詢字符串。