Linux下网页编码默认为UTF-8,修改编码使之支持gb2312中文编码
用SSH登陆VPS,修改httpd.conf文件
命令:
cd /etc/httpd/conf/
vi httpd.conf
查找:AddDefaultCharset
把:AddDefaultCharset UTF8 改为:AddDefaultCharset OFF
这样,以后打开页面时就会按网页的编码来了
用SSH登陆VPS,修改httpd.conf文件
命令:
cd /etc/httpd/conf/
vi httpd.conf
查找:AddDefaultCharset
把:AddDefaultCharset UTF8 改为:AddDefaultCharset OFF
这样,以后打开页面时就会按网页的编码来了
本地wamp实现虚拟主机后,我把自己的站放进去就出现了500错误看日志看到
.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration不支持伪静态,那么我来分享一下本地wamp实现伪静态:
第一步:找到Apache安装目录下httpd.conf这个文件,搜索找到,“LoadModule rewrite_module modules/mod_rewrite.so”,找到这一行,去掉前面的“#”;
第二步:找到“AllowOverride None”改为“AllowOverride All”.;
第三步:重启apache
第四步:新建.haccess文件,放在当前网站根目录下,在.haccess文件中写伪静态规则,看示例
RewriteEngine on
RewriteBase /
RewriteRule ^article\.html$ /article.php [L]
RewriteRule ^article\_([0-9]+)\.html$ /article.php?page=$1 [L]
到此就完成了。
是不是自己老了,php环境搞了一天,最后还得用wamp套件来安装。。终于搞定,太颓了。
写一下wamp本地做虚拟主机:
1.在“httpd.conf”文件中查找:Include conf/extra/httpd-vhosts.conf,去掉前面的注释#。
2.把#LoadModule vhost_alias_module modules/mod_vhost_alias.so 去掉前面的注释#
3. 改D:\wamp\bin\apache\Apache2.2.17\conf\extra \httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.hleclerc-PC.ingenidev
DocumentRoot ”D:\wamp\www\www.demo.com”
ServerName www.demo.com
ErrorLog ”logs/www.demo.com-error.log”
CustomLog ”logs/www.demo.com-access.log” common
</VirtualHost>
4. 修改C:\WINDOWS\system32\drivers\etc\hosts
127.0.0.1 www.demo.com
5.重启apache OK搞定