如何制作静态动态页面?
在 MyBB 论坛中,您一定已经看到所有这些线程都存储为 forum.com/Thread-Name-of-the-thread 那么现在这是静态的吗?
现在我有一个网站,其中有
blog.com/search.php?=SEARCHED+TEXT
那么现在我如何保存此搜索,以便 Google 可以在我的网站上找到此页面?
我间接想说的是我如何制作
blog.com/SEARCHED+TEXT.html
In MyBB forums you must have seen that all those threads are stoed as forum.com/Thread-Name-of-the-thread
So now this is static right ?
So now i have a site which has
blog.com/search.php?=SEARCHED+TEXT
So now how do i save this search so that Google can find out this page on my site ?
Indirectly what i mean to say is how i can i make
blog.com/SEARCHED+TEXT.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
“所以现在这是静态的,对吗?”不。仅仅因为 URL 不以 .php 或类似内容结尾并不意味着它是静态的。是时候了解 mod_rewrite 的神奇之处了:
http://www.workingwith.me。英国/文章/脚本/mod_rewrite
"So now this is static right?" No. Just because the URL doesn't end in .php or similar doesn't mean it's static. It's time for you to learn the wonders of mod_rewrite:
http://www.workingwith.me.uk/articles/scripting/mod_rewrite
你的第一个例子根本不是静态的。它只是使用一个工具根据 URL 路由请求。
要获得相同的功能,您所需要做的就是调查 URL使用 PHP 进行路由 并在您的应用程序中实现它。
Your first example isn't static at all. It's just using a tool to route the request based on the URL.
All you need to get the same functionality is to investigate URL Routing in PHP and implement it in your application as well.
如果您希望 Google 索引此搜索页面,您必须通过 Sitemap 或在您的网站上放置一个 Google 可以抓取的链接。谷歌过去确实填写过表格,但我不确定他们是否仍然这样做,据我所知,他们只在选定的几个网站上这样做。
要使搜索静态化,您必须渲染页面一次并将其存储在文件中。无论您是通过在浏览器中调用文件然后保存来手动执行此操作,还是通过 缓存系统由您决定。
If you want Google to index this search page you have to tell Google it exists, either through a Sitemap or by putting a link on your site that Google can crawl. Google did fill in forms in the past, but I am not sure if they still do and afaik, they only did on a selected few sites.
To make the search static, you have to render the page once and store it in a file. Whether you do that manually by simply calling up the file in your browser and then saving it or by means of a Caching System is up to you.