如何启用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规则已经启用。
- ● 自制(IP或域名)可信任的SSL证书,适用360、chrome等浏览器
- ● windows系统下php无法使用curl怎么办?
- ● 绿联UGREENKVM切换器(分屏器)快捷键丢失解决办法
- ● 统信UOS开机指定网址全屏启动自带浏览器以及屏蔽ALT+F4关闭
- ● xshellSSH连接Linux服务器防止超时退出
- ● php8开启OpenSSL扩展库报错disabledinstallext
- ● 统信系统linux安装php时的报错libxml-2.0>=2.7.6
- ● tidb关闭sql_mode=ONLY_FULL_GROUP_BY模式
- ● windows10如何开机自动运行bat文件
- ● Win10Mysql8初始密码丢失,初始化又不显示密码
- ● PHP批量对TCP服务端指定多个IP非阻塞检查在线状态
- ● python实现TCP服务端持续接收关机、重启指令并输出结果【系列三】
- ● PHP给TCP服务端发送指令【系列二】
- ● PHP判断TCP服务端是否在线【系列一】
- ● PHP判断远程文件是否存在
- ● LINUX下用PHP获取CPU型号、内存占用、硬盘占用等信息代码
- ● PHP代码用UDP方式远程唤醒电脑让计算机开机
- ● apache下php生成验证码图片不能显示
- ● PHP使用AES加密解密示例(无偏移)
- ● Pluginmysql_native_passwordreported:''mysql_native_password'isdeprecate问题