拥有没有文件扩展名的页面资源是否安全?

发布于 2024-08-12 04:18:09 字数 342 浏览 3 评论 0原文

我需要决定新网站的命名约定。 我可以随意使用mod_rewrite。

我最喜欢的解决方案是完全不使用文件扩展名。

www.exampledomain.com/language/pagename

这将导致“pagename”被视为目录。使用相对链接时我必须考虑到这一点。

这样做时我还需要注意其他陷阱吗?

这是否合法,或者资源是否应该具有“name.prefix”结构?

您是否知道有哪些客户无法处理此问题并开始寻找 /index.htm 或 .html?

您能想到任何 SEO 问题吗?

I need to decide on naming conventions for a new website.
I can use mod_rewrite at will.

My favourite solution would be to work with no file extension at all.

www.exampledomain.com/language/pagename

this would lead to "pagename" being treated as a directory. I would have to take that into account when using relative links.

Are there any other pitfalls I need to be aware of when doing this?

Is this legal, or are resources supposed to have a "name.prefix" structure?

Do you know of any clients that can't deal with this and start looking for /index.htm or .html?

Can you think of any SEO problems to be expected?

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

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

发布评论

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

评论(2

云雾 2024-08-19 04:18:09

除非您有充分的理由添加扩展,否则请放弃它。

资源是否应该具有“name.prefix”结构?

据我所知没有。通常不会。资源只是一个概念。自定义资源格式可能有该扩展要求,而其他格式则没有。这将取决于。

对于SEO来说,链接越短越好。它将增加关键字的相对权重。扩展将使链接长度增加 4 个字符或更多。

您是否知道有哪些客户端无法处理此问题并开始寻找 /index.htm 或 .html?

如果您决定支持多个入口点,可能会出现问题。

www.exampledomain.com
www.exampledomain.com/index.html
www.exampledomain.com//index.htm
www.exampledomain.com/index

这些都是搜索引擎的不同网址。有些人会使用最短的名称链接到您,其他人会使用其他版本。最终会有不同的入站链接指向您的网站起始页,这些链接本质上是相同的。搜索引擎会检测到它并将其视为内容重复。因此,您的页面排名将分为多个网址版本。最后,除了一个之外,所有其他都可能会完全从其索引中删除。要处理这种情况,请决定一个“真实”url,并让其他人执行 301 重定向(永久移动)到“正确”url。

Unless you have a very good reason to add an extension, drop it.

are resources supposed to have a "name.prefix" structure?

Not that I know of. Normally not. Resources are just a concept. A custom resource format may have that extension requirement, the other would not. It will depend.

As for SEO, the short a link is, the better. It will increase relative weight of keywords. An extension would make links longer by 4 characters or more.

Do you know of any clients that can't deal with this and start looking for /index.htm or .html?

A problem may arise if you decide to support multiple entry points.

www.exampledomain.com
www.exampledomain.com/index.html
www.exampledomain.com//index.htm
www.exampledomain.com/index

These are all different urls to search engines. Some people will be linking to you with the shortest name, the others will use the other version. Then ultimately there will be different inbound links pointing to your site start page which will essentially be the same. Search engines will detect it and see it as content duplication. Consequently, your page rank will be divided between several url versions. Finally, all except one will likely be dropped out of their index entirely. To deal with this situation, decide for one "true" url and let others perform 301 redirect (moved permanently) to the "correct" url.

宣告ˉ结束 2024-08-19 04:18:09

放弃扩展实际上有一个显着的好处,那就是不将您束缚于特定的语言。如果您的 URL 是 http://example.com/page.php 并且您切换到另一种语言,您要么会丢失现有的 URL(糟糕!),要么必须伪造 PHP 扩展(笨拙) )。

Dropping extensions actually has the significant benefit of not tying you to a specific language. If your URLs are http://example.com/page.php and you switch to another language, you'll either lose the existing URLs (bad!) or have to fake the PHP extension (clunky).

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