大网数据广告活动
网站运营与故障问答

Best SEO practice for static pages: having "index.html" or not?

· 52CE 我爱测

I'm trying to SEO optimize my blog, and I'm not sure which method is the best SEO practice. I seem to google conflicting results. Some say 1. is best because of days old, other says nowadays index.html isn't as important as it wa…

问题原文

原帖链接 · Grumpy ol' Bear · CC BY-SA 3.0

I'm trying to SEO optimize my blog, and I'm not sure which method is the best SEO practice. I seem to google conflicting results. Some say 1. is best because of days old, other says nowadays index.html isn't as important as it was.

If it's important, I'm running WordPress as blog software. Self-hosted.

I have the choice to have it:

  1. https://www.example.com/post-title/index.html
  2. https://www.example.com/post-title.html
  3. https://www.example.com/post-title

已采纳解答

原帖链接 · Mike -- No longer here · CC BY-SA 3.0

Aim for friendly URLs.

Unless your blog talks about html code and you wanted to share links to examples of html code, I suggest trying to craft your URLs to exclude the extension.

So your blog URL could be (for example) something like this:

https://example.com/post-date/post-title/page-number

then you can have it map to this sample URL:

https://example.com/script.php?posttitle=title&postdate=date&pagenumber=number

If your server is apache based, then you can create an .htaccess file in the document root folder with the following contents:

RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ /script.php?posttitle=$1&postdate=$2&pagenumber=$3

then the script will take in the contents before the first slash in the URL after the http:// as the posttitle value and the contents between the two single slashes as the postdate value and the contents after the final slash as the pagenumber value.

Depending on how your wordpress script handles parameters, you may need to change /script.php?posttitle=$1&postdate=$2&pagenumber=$3 to match the wordpress script name and load the parameters correctly.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。