很多时候刚搭建的环境在第一次浏览项目时首页时正常的,但是点击任何一个子菜单会提示xxxx was not found on this server.这一般是apache没有开启重写的功能
Windows如何开启Rewrite模块
环境:
系统 Windows
Apache 2.4
加载Rewrite模块:
在conf目录下httpd.conf中找到
LoadModule rewrite_module modules/mod_rewrite.so
这句,去掉前边的注释符号“#”,或添加这句。
允许在任何目录中使用“.htaccess”文件,将“AllowOverride”改成“All”(默认为“None”):
# 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
在Windows系统下不能直接建立“.htaccess”文件,可以在命令行下使用“echo a> .htaccess”建立,然后使用记事本编辑。