Apache下的URL重写
ps:本人亲测,阿里云2核4G5M的服务器性价比很高,新用户一块多一天,老用户三块多一天,最高可以买三年,感兴趣的可以戳一下:阿里云折扣服务器
1、打开apache配置,设置httpd.conf,搜索LoadModule rewrite_module modules/mod_rewrite.so,并打开这个模块
2、打开apache配置,设置httpd.conf,搜索# Virtual hosts
Include conf/extra/httpd-vhosts.conf,把Include conf/extra/httpd-vhosts.conf前面的#去掉
3、打开Apache目录下的conf/extra/httpd-vhosts.conf文件
4、设置<VirtualHost 127.0.0.2:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "C:/xampp/htdocs/TEST/myMVC"
ServerName myMVC.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
RewriteEngine On
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}!-d
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}!-f
RewriteRule /index.html /index.php
</VirtualHost>