简体   繁体   English

301重定向后,谷歌发现奇怪的网址

[英]After a 301 redirect google finds strange urls

I have the following redirect in .htaccess: 我在.htaccess中有以下重定向:

Options -MultiViews

    RewriteBase /
    rewritecond %{THE_REQUEST} \s/+product\.php\?id=([^\s&]+)&name=([^\s&]+) [NC]
    rewriterule ^ %2/%1? [R=301,L]
    rewritecond %{REQUEST_FILENAME} !-d
    rewritecond %{REQUEST_FILENAME} !-f
    rewriterule ^([^/]+)/([^/]+)?$ /product.php?id=$2&name=$1 [L,QSA]

which works great. 效果很好。 Also in place: 也到位:

<base href="/" />

However on this page I have links to other pages which work ok when you click on them. 但是,在此页面上,我具有指向其他页面的链接,当您单击它们时它们可以正常工作。 They are defined like so: 它们的定义如下:

<a href="http://www.mysite.co.uk/Roland-HPi50e-Digital-Piano-in-Rosewood/518">
<img src="/files/images/special_roland_hpi50e_160x500px.png" alt="Roland HPi Pianos">
</a>

The problem is - google doing something strange it is finding for example: 问题是-谷歌正在做一些奇怪的事情,例如:

http://www.mysite.co.uk/a product/Roland-HPi50e-Digital-Piano-in-Rosewood/518

Is there anybody who can help me to sort this problem as I don't know what causes this. 有谁可以帮助我解决此问题,因为我不知道是什么原因造成的。 Any help welcome. 任何帮助欢迎。

Might possible escape string problem, try this one, hope this will help you 可能会出现转义字符串问题,请尝试使用此问题,希望对您有所帮助

RewriteEngine On
RewriteCond %{QUERY_STRING} ^out=([^&]+)
RewriteRule ^/?$ http://www.mysite.co.uk/Roland-HPi50e-Digital-Piano-in-Rosewood/518 [L,R=301]

Remove this tag: 删除此标签:

<base href="/" />

For fixing images/css paths use absolute path in your css, js, images files rather than a relative one. 修复图像/ css路径 ,请在css,js,图像文件中使用绝对路径,而不要使用相对路径。 Which means you have to make sure path of these files start either with http:// or a slash / . 这意味着您必须确保这些文件的路径以http://或斜杠/开头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM