總之,我們目前遇到了我們的htaccess文件問題。 301重定向到達新的描述的URL,但此外,新的URL後面跟着一個?和舊的網址。我們如何擺脫?和以前的網址,因此它們不會顯示爲結尾。如何防止舊的URL和?通過htaccess包含在301重定向的URL中
我們在網上發現這個問題的例子都沒有出現。任何人都可以請提供一些建議?我們可以使用RewriteRule來阻止這種情況的發生嗎?
這裏的htaccess文件
# begin redirects
# There are redirects of a number of old pages. Here's a sample of them.
redirect 301 /index.html http://www.petersommer.com/
redirect 301 /escorted-archaeological-tours/turkey/western-lycia-cruise-july/ http://www.petersommer.com/escorted-archaeological-tours/
RewriteRule ^gallery/main.php$ http://www.petersommer.com/gallery/ [R=301,L]
RewriteRule ^pdf/how_to_book.pdf$ http://www.petersommer.com/pdf/how-to-book-holiday.pdf [R=301,L]
# end redirects
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
DirectoryIndex index.php
RewriteEngine On
RewriteCond $1 !^(images|system|themes|pdf|favicon\.ico|robots\.txt|index\.php) [NC]
RewriteRule ^\.htaccess$ - [F]
RewriteRule ^favicon\.ico - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
DirectoryIndex index.php
的總結不幸的是我不知道什麼是不工作或需要做的事情,以解決它。我認爲它必須是重寫規則中的某些內容,或者我們需要添加一些重寫規則來修復它。
不幸的是,所有的重定向添加?並將舊網址添加到新的重定向網址的末尾。因此,例如:
通到/escorted-archaeological-tours/?/tours2006.html
,而不是僅僅/escorted-archaeological-tours/
重定向 /escorted-archaeological-tours/
去所有都遵循同樣的模式 - 很遺憾。
如果您可以在重寫規則中看到任何故障或可以識別需要添加的內容,我將非常感激。
非常感謝你的努力幫助。不幸的是,我仍然無法完成工作。你會改變文件中的順序嗎?還有其他建議嗎?感謝您的意見。祝好,彼得 – petersommer 2012-04-09 11:39:00
@petersommer我剛剛在您的網站上檢查了/index.html,重定向按預期工作。也許緩存問題?還是你找到另一種解決方案? – nikoshr 2012-04-11 16:22:24