基于目录的友好URL? [英] Are friendly URLs based on directories?

查看:92
本文介绍了基于目录的友好URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读有关SEO的许多文章,并调查如何改进我的网站。我发现一篇文章说,使用友好的URL可以帮助在线索引器找到并定位您的网站,而不是使用具有大量GET参数的URL,因此我决定将我的网站调整为这种URL。我也读过,有一种方法(编辑.htaccess),但它不是最好的方法,它看起来不是很好。

I've been reading many articles about SEO and investigating how to improve my site. I found an article that said that having friendly URLs help online indexers to find and positionate your site better than using URLs with lots of GET parameters so I decided to adapt my site to this kind of URL. I've also read that there's a way (editing .htaccess) but it's not the best way and it doesn't look really good.

例如,这就是Google的关于网址如下:

For example, that's how Google's About URL looks like:

https://www.google.com/search/about/es/

当浏览到FTP时,他们会看到目录 search / about / ES / index.html中?如果是这样,您必须为每种语言创建许多文件和目录,而不是使用& l = es ,是否值得?

When surfing into FTP do they see the directories search/about/es/index.html? If so, you must create many files and directories for each language instead of using &l=es, is it that worth?

推荐答案

您无法确定资源如何映射到URL。

You can never know (for sure) how resources are mapped to URLs.

例如,URL https://www.google.com/search/about/es/ 可以


    <指向HTML文件 /search/about/es/index.html
  • 指向HTML文件 /foo/bar/1.html

  • 指向PHP脚本 /index.php

  • 指向PHP脚本 /search.php?title=about&lang=es

  • 指向可从URL https://internal.google.com/1238

  • ...
  • 的文档
  • point to the HTML file /search/about/es/index.html
  • point to the HTML file /foo/bar/1.html
  • point to the PHP script /index.php
  • point to the PHP script /search.php?title=about&lang=es
  • point to the document available from the URL https://internal.google.com/1238

从请求的URL中,服务器总是决定要传递哪个资源。除非您有权访问服务器,否则无法知道如何使用。 (即使URL以 .php 结尾,那根本就不一定是PHP。)

It’s always the server that, given the URL from the request, decides which resource to deliver. Unless you have access to the server, you can’t know how. (Even if a URL ends with .php, it’s not necessarily the case that PHP is involved at all.)

服务器可以查找实际存在的文件(如果涉及到URL重写:即使在其他位置,URL路径建议),服务器也可以运行一个脚本来生成文档(例如,您的数据库中的内容),服务器可以输出其他URL等可用的文件。

The server could look for a file that physically exists (if URL rewriting is involved: even in "other" places than what the URL path suggests), the server could run a script that generates a document on the fly (e.g., taking the content from your database), the server could output the file available from another URL, etc.

相关维基百科文章:

  • Rewrite engine
  • Web framework: URL mapping
  • Front controller

这篇关于基于目录的友好URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆