WDlinux官方论坛's Archiver

wxinc 发表于 2013-5-26 14:44

wdcp如何设置WORDPRESS伪静态规则?

找了好久了。。。。伪静态规则没找到,也不知道怎么加。希望高手说一下

tradeteacher 发表于 2013-5-26 14:57

如果是 nginx+apache  的话,伪静态只要在wp的根目录放htaccess文件就行。[code]
# WordPress开始
RewriteEngine on
#
#除非你在此之前已经设置了不同的RewriteBase
#你可以删除或不注释以下代码
# RewriteBase 指令:
RewriteBase /
#
#如果这个请求是针对“/”或者是已经写入到WP中了
RewriteCond $1 ^(index\.php)?$ [OR]
#或者如果这个请求是针对image, css, 或js文件
RewriteCond $1 \.(gif¦jpg¦css¦js¦ico)$ [NC,OR]
#如果URL指向存在的文件
RewriteCond %{REQUEST_FILENAME} -f [OR]
#如果URL指向了存在的目录
RewriteCond %{REQUEST_FILENAME} -d
# 那么跳过重写直接到WP
RewriteRule ^(.*)$ - [S=1]
#否则指向WP重写该请求
RewriteRule . /index.php [L]
#
#WordPress结束        
[/code]

tradeteacher 发表于 2013-5-26 14:59

将以上代码另存为.htaccess,上传到更目录[attach]3029[/attach]

rainbow 发表于 2013-11-22 00:25

[b]回复 [url=http://www.wdlinux.cn/bbs/redirect.php?goto=findpost&pid=23753&ptid=6021]2#[/url] [i]tradeteacher[/i] [/b]


   非常感谢!

walkarc 发表于 2014-1-3 13:08

[b]回复 [url=http://www.wdlinux.cn/bbs/redirect.php?goto=findpost&pid=23754&ptid=6021]3#[/url] [i]tradeteacher[/i] [/b]


    不需要做其他的设置么?

microsoftool 发表于 2014-1-3 13:30

我也想知道呢

吞噬 发表于 2014-2-20 09:02

如果只是apache需要怎么设置呢?

sulinquan 发表于 2014-6-14 15:38

[b]回复 [url=http://www.wdlinux.cn/bbs/redirect.php?goto=findpost&pid=23752&ptid=6021]1#[/url] [i]wxinc[/i] [/b]


    我找了3天,花钱找人弄,还没弄好,最后息壤总公司给弄好的,
这个伪静态就可以:

location /themes\/.*\.(html|xml)$ {
    return 403;
}
location /mobile {
    if (!-e $request_filename) {
        rewrite ^/mobile/(.*)$ /mobile/index.php last;
    }
}
if (!-e $request_filename) {
    rewrite ^(.*)$ /index.php last;
}        


保存成他:wordpress-nginx.conf

Sealones 发表于 2014-11-28 15:09

经鉴定使用,次方法可行。

崔小可 发表于 2014-11-28 15:40

我也装的wordpress,楼上的这些方法我都试了,都不能解决。

cai6117 发表于 2015-4-30 15:44

8楼的方法是可行的,弄好后,重启下就OK了。

jangru 发表于 2016-1-24 00:55

用八楼的   不重启  直接ok

海的宝宝 发表于 2016-12-19 23:07

8楼的方法可行  不重启  直接ok

oy86866 发表于 2016-12-28 16:15

为啥你们都喜欢伪静态?

jklicey 发表于 2018-7-25 13:36

感谢8楼     谢谢

lintrens 发表于 2018-8-16 09:22

感谢8楼     谢谢

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.