du77887 2015-02-25 22:42
浏览 19
已采纳

如何博客网址工作?

Hello guys I was wondering how blog articles work I mean they are stored in a database right? so how come when I go to an articles its like this:

www.something.com/seths_blog/2015/02/shoes-that-dont-fit-and-free-salt.html

for example I mean do they use php create and create these blogs on files on there htaccess or there is a way to do it efficiently I mean they got to put in it in a Database because sorting comments and so are much more efficient rating and such or polls are well really need the answer thank you

  • 写回答

1条回答 默认 最新

  • doushan2811 2015-02-25 22:54
    关注

    Edit your .htaccess file to add this:

    #forward all traffic to index to be handled there except resources
    RewriteCond %{REQUEST_URI}  !(\.png|\.jpg|\.gif|\.jpeg|\.bmp|\.js|\.css)$
    RewriteRule (.*)  index.php [QSA]
    

    Note that any other file types you don't want to be forwarded will need to be added to the list of file types above. What this line is doing is forwarding all file requests to your index.php file except the ones you declare (like images).

    Next, go to your index.php file and add this code:

    echo "My URL is:" . $_SERVER['REQUEST_URI'];
    

    This is the basic answer. Now, any question you have beyond this is a matter of basic PHP (and probably MySQL). You can manipulate that data in a limitless combination of ways.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?