如何启用Apache服务器的rewrite和.htaccess功能
大家在使用Appserv服务器伪静态规则时,会利用.htaccess文件,但是如果当你打开网站,第一眼看到如下信息:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, admin and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.
Apache/2.2.8 (Win32) PHP/5.2.6 Server at www.mdaima.cn Port 80
这说明你的服务器并没有开启.htaccess文件支持功能,那么如何开户这个功能呢?
第一步,httpd.conf 文件里 查找“<Directory />”把里面的 AllowOverride None 改成 AllowOverride all 即可,改完后的代码如下:
<Directory /> Options FollowSymLinks AllowOverride all Order deny,allow allow from all </Directory>
第二步,查看一下你的phpinfo(),如果在apache2handler的Loaded Modules 中找到了mod_rewrite 那么说明你的rewrite module已经加载了。如果没有开启“mod_rewrite”,则打开您的apache安装目录“/apache/conf/”下的 httpd.conf 文件,通过Ctrl+F查找到“LoadModule rewrite_module”,将前面的"#"号删除即可;如果没有查找到,则到“LoadModule”区域,在最后一行加入“LoadModule rewrite_module modules/mod_rewrite.so”(独占一行)。
到这里重启apache服务,URL重写rewrite规则已经启用。
- ● 如何利用支付宝生成在线支付表单和链接?
- ● 关于开启ApacheGZIP功能及开启时报错误提示的解决办法
- ● 百度编辑器ueditor,如何在源码模式与富文本模式相互切换
- ● JQuery中$.get(),$.post(),$.ajax(),$.getJSON()的区别及用法
- ● 通过JiaThisAPI接口自定义分享功能按钮实现分享功能本地化
- ● jQuery与JavaScript获取当前页面的URL信息方法及使用说明
- ● MySQL如何利用索引优化WHERE和ORDERBY的查询语句效率
- ● 解决百度编辑器UEditor保持前台与后台代码高亮显示一致的样式及换行的问题
- ● PHP常用文件函数名称与功能介绍大全
- ● 讲一讲如何在一个页面中使用多个百度分享按钮,分享不同的文章