“水上和水下”超链接管理系统的想法?
我希望这个问题听起来并不疯狂:在一个多语言网站上,想象几个实际文件,其中包含当前可以在其文件名下访问的内容:
website.org/en/tomato.php
website.org/nl/tomato.php
website.org/de/tomato.php
这些都是同一个 php 文件,它前面的文件夹告诉 php获取什么内容。现在这个名字对于我的文件管理来说很短而且很方便,但是对于搜索引擎来说这些文件名都非常不吸引人。那么,有什么方法可以使这些平面文件具有更奇特的名称,例如:
website.org/en/tomato.php-fist-The-Forgotten-Red-Punch
website.org/nl/tomaat.php-vuist-De-Vergeten-Rode-Vuist
website.org/de/tomate.php-faust-Die-Fergessen-Rote-Faust
目前,我的 php 理解文件名前面的文件夹 /en/
或 /nl/
并放置将正确的语言添加到 tomato.php 文件中。
我的梦想是拥有一个每种语言的文件名,然后以某种方式告诉 php/apache 使其工作并在命名引擎下无形地获取正确的文件。
我真的还没有准备好使用 cms 框架,我很高兴我可以自己管理我的平面文件。什么是一种创造性的方式来进行链接管理,以便我可以更奇特地标记水面以上的链接,同时将短文件名保留在水面以下?
解决方案/想法/建议/代码都非常受欢迎,并被视为可能的答案,非常感谢。
a question that I hope does not sound crazy: On a multilingual site, imagine several actual files with contents in them which are currently reachable under their file names:
website.org/en/tomato.php
website.org/nl/tomato.php
website.org/de/tomato.php
These are all one and the same php file, the folder infront of it tells the php to fetch what content. Now this name is short and handy for my file managemens, but the file names are all very unsexy for search engines. So, what are the ways to make these flat files having more exotic names like:
website.org/en/tomato.php-fist-The-Forgotten-Red-Punch
website.org/nl/tomaat.php-vuist-De-Vergeten-Rode-Vuist
website.org/de/tomate.php-faust-Die-Fergessen-Rote-Faust
Currently, my php nderstands the folder /en/
or /nl/
preceding the filenames and puts the correct language into the tomato.php file.
It is my dream to have a per language file name which then somehow tells php/apache to make it work and fetch invisibly underneath the naming engine the correct file.
I am really not ready for a cms framework, I'm happy I can manage my flat files myself. What would be a creative way to have a links management where sothat I can tags my links above the water more exoticly, while keeping the short file names below water for myself?
Solutions/ideas/suggestions/code are all very welcome and treated as possible answers and are Much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对于 Apache 和 mod_rewrite 来说很常见...有多种方法可以做到这一点 - 最常见的方法是将所有文件重写到 .htaccess
中的 index.php:
RewriteRule .* index.php [L]
然后在您的 index.php 中检查 PATH_INFO 并与您的数据库进行比较以获取关联的真实文件。
这里有一些教程:
http://techie-buzz.com/how-to/create-seo-friend-urls-using-mod-rewrite-and-php-part-1.html
http://articles.sitepoint.com/article/search-engine-friend-urls
This is very common to handle with Apache and
mod_rewrite
... there are a number of ways to do this - the most common way is to rewrite all files to index.phpIn .htaccess:
RewriteRule .* index.php [L]
Then in your index.php check PATH_INFO and compare against your database for the associated real file.
A few tutorials here:
http://techie-buzz.com/how-to/create-seo-friendly-urls-using-mod-rewrite-and-php-part-1.html
http://articles.sitepoint.com/article/search-engine-friendly-urls