15053971836 注册 / 登录

wordpress怎么设置伪静态

时间: 阅读:277
wordpress怎么设置伪静态

最佳回答

清风若雨

清风若雨

2023-01-16 01:51:16

你好,设置方法如下:
用下面这个试试:
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]

最新回答共有2条回答

  • 清风若雨
    回复
    2023-01-16 03:03:18

    1、进入WP后台,【设置】--【固定连接】里面,先把固定连接选择自定义,设置成/%post_id%.html。
    2、上传下面的404.php页面到网站根目录下,然后在虚拟主机控制面板里面修改404跳转页面为刚才上传的404.hph,这样就可以实现伪静态了。
    404.php
    <?php
    $pos
    =
    strrpos($qs,
    '://');
    $pos
    =
    strpos($qs,
    '/',
    $pos
    +
    4);
    $_SERVER['REQUEST_URI']
    =
    substr($qs,
    $pos);
    $_SERVER['PATH_INFO']
    =
    $_SERVER['REQUEST_URI'];
    include('index.php');
    ?>