一、Apache伪静态
1.在httpd.conf中找到
#LoadModule rewrite_module modules/mod_rewrite.so
改成
LoadModule rewrite_module modules/mod_rewrite.so
去掉井号
2.在httpd.conf中找
AllowOverride none
改成:
AllowOverride All
3.网站根目录有.htaccess文件里面是伪静态规则
4.修改完成重启Apache服务
二、Nginx添加伪静态
1.修改项目mywebs.conf配置文件
2.添加伪静态
server { listen 80; server_name www.baidu.cn baidu.cn; root /home/wwwroot/baidu; index index.php; include /usr/local/nginx/conf/enable-php.conf; try_files $uri $uri/ @rewrite; location @rewrite { rewrite ^/(.*)$ /index.php?_url=/$1; } }
3.重启nginx