gpt4 book ai didi

linux - 从 google 搜索 URL 中删除 index.php

转载 作者:太空宇宙 更新时间:2023-11-04 03:39:44 26 4
gpt4 key购买 nike

我希望能够删除 index.php URL从谷歌的搜索列表中,您在搜索网站标题(中间有或没有空格)时也许可以看到这一点。在我的第二页上,它显示了我的网站,但 URL 末尾有 index.php!

我已经编辑了 httpd.conf,从我的 URL 末尾删除了 index.php,您可以在下面看到我所拥有的内容:

<VirtualHost *:80>
ServerName joemethven.com
DocumentRoot /var/www/html/joemethven/
</VirtualHost>

Options -MultiViews

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]

当网站加载 joemethven.com 时,为什么 Google 会选择 index.php?有什么办法可以防止这种情况发生吗?!

感谢您的阅读,希望对大家有所帮助! :)

更新:我刚刚在我的网站文件夹中快速添加了一个 .htaccess 文件,其中包含以下信息:

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

我不知道这是否会产生任何更改,但是我运行没有此问题的网站的其他服务器在其 .htaccess 文件中包含此信息。

最佳答案

修复比我想象的要容易,只需转到 Google 的网站管理员工具,我使用“提交到索引”功能并设置我的首选 URL(不带 index.php),它就为我改变了!

关于linux - 从 google 搜索 URL 中删除 index.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30278981/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com