dongqianchi0512 2010-11-27 19:21
浏览 45
已采纳

wordpress SEO友好网址是否可以在不使用htaccess的情况下工作?

Wordpress uses friendly seo url without using htaccess.

Can any explain this to me please how they do it.

The only way i can think of is to do something like this.

domain.com/index.php/nnn/mmmm/

But wordpress does not use index.php

I know they are not using htaccess.

Please let me know.

Thank you.

  • 写回答

4条回答 默认 最新

  • dongnuochen9449 2010-11-27 19:41
    关注

    WordPress actually has a single .htaccess file that they don't need to change which redirects all requests to index.php

    index.php then looks at the permalinks rules and runs a few database queries to determine which page to send you.

    So for instance if the permalink rule is %postdate%/%postname% (may not be the actual WordPress permalink variables. I haven't been using WordPress for too long) then it would just use regular expressions (or combinations of substr() and strpos()) to put %postdate% and %postname% into variables. Next it runs a simple database query for any item matching that date and that name. If nothing is found, redirect to search. If you find more than one, list them all (like a category page). If you find one and only one, send that page.

    As far as actually "sending" the page, that's just a matter of settings certain variables (such as $the_post['content']) and then include()'ing the proper theme file.

    include()'ing the theme file is a simple if() statement.

    if(file_exists("wp-content/themes/<your_theme>/$the_post['type'].php")){
        include("wp-content/themes/<your_theme>/$the_post['type'].php");
    } else {
        include("wp-content/themes/<your_theme>/index.php");
    }
    

    Mind you these aren't the exact variable names or the exact functions as they occur. This is just a very simplified version to give the general idea of how these systems work.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用