wasw100's Blog
上一篇: 下一篇:
2010年03月3日

windows下apache支持wordpress的url rewrite

参考文章:http://sexywp.com/how-to-config-mod-rewrite-in-win.htm

在本地调试wordpress时apache服务器可能不支持url rewrite,可以根据如下步骤修改配置:

1.打开apache的配置文件:httpd.conf 搜索:LoadModule rewrite_module modules/mod_rewrite.so
把前面的#去掉

如果执行完第一步,重启服务器后,还是不支持url rewrite,那么执行第二步

2.在 httpd.conf 中存在下面格式的文字

<Directory "D:/tools/Apache2.2/htdocs">
    #
    # 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

</Directory>

AllowOverride None 改为 AllowOverride All 就可以了。
(注意:可能有多个Directory标签,找到你wordpress所在目录的那个修改)

3.在要url重写的目录建立一个名为: .htaccess 的文件(worldpress在开启url重写后会自动生成)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

4.重启apache,这样apache就支持url rewrite了

–EOF–

返回顶部