wordpress本地测试站开启伪静态

首先打开httpd.conf 文件,找到LoadModule rewrite_module modules/mod_rewrite.so,去掉前面的#号。

找到你网站设置目录把 AllowOverride设置为All,默认显示的是None。

<Directory “E:/lamp/www”>

    #

    # Possible values for the Options directive are “None”, “All”,

    # or any combination of:

    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

    # Note that “MultiViews” must be named *explicitly* — “Options All”

    # doesn’t give it to you.

    #

    # The Options directive is both complicated and important.  Please see

    # http://httpd.apache.org/docs/2.2/mod/core.html#options

    # for more information.

    #

    Options Indexes FollowSymLinks

    #

    # AllowOverride controls what directives may be placed in .htaccess files.

    # It can be “All”, “None”, or any combination of the keywords:

    #   Options FileInfo AuthConfig Limit

    #

    AllowOverride All

    #

    # Controls who can get stuff from this server.

    #

    Order allow,deny

    Allow from all

再去后台设置静态规则,我设置为这样的/%postname%.html 。

接下来看看网站根目录会自动生成.htaccess文件里面会写入如下内容

# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /w/

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /w/index.php [L]

# END WordPress

/w/是我安装wp的目录。

接下来重启Apache就可以了。

What do you think?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v3.5.6