如何让 google 将我的链接显示为 example.com 而不是 example.com/

发布于 2024-09-25 18:50:04 字数 1574 浏览 2 评论 0原文

目前谷歌将我的网站链接显示为...

example.com/

...但是,我希望它显示为...

example.com

我确实有以下元数据

<link rel="canonical" href="http://example.com" />

...下面是我的 htaccess 文件...

IndexIgnore * 

ErrorDocument 400 /error 
ErrorDocument 401 /error 
ErrorDocument 403 /error 
ErrorDocument 404 /error 
ErrorDocument 500 /error 

RewriteEngine on 
RewriteBase / 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ 
RewriteRule ^index\.php$ / [R=301,L] 

RewriteRule ^(home|cv|handouts|links|contact|copyright|cv)/?$ /index.php?module=home&action=$1 
RewriteRule ^(log(in|out))/?$ /index.php?module=authentication&action=$1 

RewriteRule ^photos/?$ /index.php?module=gallery&action=album&album=general 
RewriteRule ^gallery/?$ /index.php?module=gallery&action=album&album=general 
RewriteRule ^gallery/([^/\.]+)/?$ /index.php?module=gallery&action=album&album=$1 
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/?$ /index.php?module=gallery&action=album&album=$1$&page=$2 
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?module=gallery&action=item&album=$1$&page=$2&item=$3 

RewriteRule ^release/?$ /index.php?module=release&action=release 
RewriteRule ^error/?$ /index.php?module=error&action=error 

...并且htaccess 文件如上所述,我注意到访问 example.com 或 example.com/index.php 会重定向到 example.com/,这可能是问题所在?

话虽如此,以及有关如何让谷歌将我的链接显示为 example.com 而不是 example.com/ 的任何想法,

提前致谢!

Currently google shows my site link as...

example.com/

...however, I would like it to be displayed as...

example.com

I do have the following meta data

<link rel="canonical" href="http://example.com" />

...and the following is my htaccess file...

IndexIgnore * 

ErrorDocument 400 /error 
ErrorDocument 401 /error 
ErrorDocument 403 /error 
ErrorDocument 404 /error 
ErrorDocument 500 /error 

RewriteEngine on 
RewriteBase / 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ 
RewriteRule ^index\.php$ / [R=301,L] 

RewriteRule ^(home|cv|handouts|links|contact|copyright|cv)/?$ /index.php?module=home&action=$1 
RewriteRule ^(log(in|out))/?$ /index.php?module=authentication&action=$1 

RewriteRule ^photos/?$ /index.php?module=gallery&action=album&album=general 
RewriteRule ^gallery/?$ /index.php?module=gallery&action=album&album=general 
RewriteRule ^gallery/([^/\.]+)/?$ /index.php?module=gallery&action=album&album=$1 
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/?$ /index.php?module=gallery&action=album&album=$1
amp;page=$2 
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?module=gallery&action=item&album=$1
amp;page=$2&item=$3 

RewriteRule ^release/?$ /index.php?module=release&action=release 
RewriteRule ^error/?$ /index.php?module=error&action=error 

... and with the htaccess file being as above, I note that visiting either example.com or example.com/index.php redirects to example.com/ which perhaps could be the problem??

With all that being said, and any ideas on how to get google to display my link as example.com NOT example.com/

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过度放纵 2024-10-02 18:50:04

运行 Google 搜索数据库中的每个网站的域名后面都有一个斜杠。唯一没有尾部斜杠的情况是当它位于路径组件之后时。路径组件尾部斜杠由每个网站的管理员决定。

将来他们可能会像 Chrome 中那样隐藏尾部斜杠,但目前您无能为力。

Run a Google Search. Every single website in their database has a trailing slash after the domain name. The only time they don't have a trailing slash is when it's after a path component. The path component trailing slash is up to each website's administrator to decide.

In the future they might hide the trailing slash like they do in Chrome but for now there's nothing you can do about.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文