• Linux下给WordPress设置装备陈设伪静态


    前导发轫:Linux公社  作者:Linux
    WordPress是一个被广泛运用的Blog系统,由于它的壮年夜,甚至在创建网站的时分也可以用到。而其支持伪静态(Wordpress Permalinks)的功用更被津津乐道。在运用LAMP平台的时分,开启Wordpress的伪静态是很便当的,而在zeus下,却出了一些小费事,记载如下:

      情形:
      ZWS 4.3r3 FreeBSD i386 6.1-RELEASE
      WordPress 2.0.4(而今最新版是2.5.1)

      启用 htaccess Support

      启用后,却发明只能让wordpress 完成下面的链接方式:

      http://www.linuxidc.com/index.php/yyyy/mm/dd/post-name/

      而我想完成的,是这样的链接方式:
      http://www.linuxidc.com/yyyy/mm/dd/post-name/

      查询了一下wordpress 文档,需求apache mod_rewrite 支持才华完成这种链接方式。

      启用 Request Rewriting

      在Rewrite Script输出以下代码:
    RULE_0_START:
    # get the document root
    map path into SCRATCH:DOCROOT from /
    # initialize our variables
    set SCRATCH:ORIG_URL = %{URL}
    set SCRATCH:REQUEST_URI = %{URL}

    # see if theres any queries in our URL
    match URL into $ with ^(.*)\?(.*)$
    if matched then
    set SCRATCH:REQUEST_URI = $1
    set SCRATCH:QUERY_STRING = $2
    endif
    RULE_0_END:

    RULE_1_START:
    # prepare to search for file, rewrite if its not found
    set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT}
    set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI}

    # check to see if the file requested is an actual file or
    # a directory with possibly an index. don’t rewrite if so
    look for file at %{SCRATCH:REQUEST_FILENAME}
    if not exists then
    look for dir at %{SCRATCH:REQUEST_FILENAME}
    if not exists then
    set URL = /index.php?q=%{SCRATCH:REQUEST_URI}
    goto QSA_RULE_START
    endif
    endif

    # if we made it here then its a file or dir and no rewrite
    goto END
    RULE_1_END:

    QSA_RULE_START:
    # append the query string if there was one originally
    # the same as [QSA,L] for apache
    match SCRATCH:ORIG_URL into % with \?(.*)$
    if matched then
    set URL = %{URL}&%{SCRATCH:QUERY_STRING}
    endif
    goto END
    QSA_RULE_END:

      随后,回到 WordPress Permalinks 举行呼应的设置,统统正常,题目处置惩罚。




    版权声明: 原创作品,理睬转载,转载时请务必以超链接形式标明文章 原始来由 、作者信息和本声明。否则将追查法律责任。

  • 相关阅读:
    Git 分支开发规范
    小程序技术调研
    弹性布局
    vue 自定义指令的魅力
    记一次基于 mpvue 的小程序开发及上线实战
    mpvue学习笔记-之微信小程序数据请求封装
    微信小程序开发框架 Wepy 的使用
    Hbuilder 开发微信小程序的代码高亮
    luogu3807 【模板】 卢卡斯定理
    luogu1955 [NOI2015] 程序自动分析
  • 原文地址:https://www.cnblogs.com/zgqjymx/p/1975770.html
Copyright © 2020-2023  润新知