Are friendly URLs based on directories?

房东的猫 提交于 2019-12-11 14:24:10

问题


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.

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

https://www.google.com/search/about/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?


回答1:


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

For example, the URL https://www.google.com/search/about/es/ could

  • 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

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.)

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.

Related Wikipedia articles:

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


来源:https://stackoverflow.com/questions/36585534/are-friendly-urls-based-on-directories

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!