Apache配置.htaccess伪静态

被网上的各种教程坑的不行,只能忙里找时间写这个教程,后期会更新IIS配置http.ini伪静态及规则!

测试apache版本httpd-2.4.6-win32-VC11

第一步,找到apache conf文件找到如下代码:

    #

    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #

    AllowOverride None

将AllowOverride None修改成AllowOverride All


第二步,找到apache conf文件找到如下代码:

   #LoadModule rewrite_module modules/mod_rewrite.so

    删除前面的#

第三步,如果你开启了虚拟空间,那么打开extra文件夹,找到httpd-vhosts.conf

<Directory "D:\root\www">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
    Order deny,allow
    Deny from all
    Allow from all
</Directory>


将其改成

<Directory "D:\root\www">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    Order deny,allow
    Deny from all
    Allow from all
</Directory>


或者此段代码同样在httpd.conf中,按照要求修改就行,