总之,我们目前遇到了我们的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