As many of you know when someone creates a StackOverflow question a new page is generated and it is visible in the various search engines as well. I was wondering how PHP code created these pages. It turns out that most websites like this have one page, something like profile.php and it loads the data from a MySQL database. My question is as follows: If there is only one physical file how can the URL change and how does google list all of the pages/profiles/question from sites like StackOverflow or Facebook if there is only one actual page?
5条回答 默认 最新
- dongrang2140 2016-09-12 19:27关注
You tell search engines 'Google, Bing, ..etc' for example to see your website by giving them
sitemap.xml
listing your pages, allow their web-bots (spider) access too the site and crawl the data and links, you may have one page likeposts.php
and it is different with parametersposts.php?id=123
orposts.php?name=mypost
Edited: If you want use one file
posts.php
and make sitehttp://domain.com/posts/posttitle
you need to apply Front Controller Pattern site point link and this implies setting you server Apache/Nginx to redirect the requests to one file (URL rewrite) and this file contain the logic for handle the request or use MVC framework解决 无用评论 打赏 举报
悬赏问题
- ¥15 微信会员卡等级和折扣规则
- ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
- ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
- ¥15 gdf格式的脑电数据如何处理matlab
- ¥20 重新写的代码替换了之后运行hbuliderx就这样了
- ¥100 监控抖音用户作品更新可以微信公众号提醒
- ¥15 UE5 如何可以不渲染HDRIBackdrop背景
- ¥70 2048小游戏毕设项目
- ¥20 mysql架构,按照姓名分表
- ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分