虚拟主机下的urlrewrite,实现伪静态,基于htaccess

今天把项目部署到虚拟主机上,原来的的伪静态就不能用了,后来在万网的帮助中心看到了个demo,我自己改了下竟然就可以了:
.htaccess,这个文件直接放到网站根目录。windows下不允许.htaccess这样的文件,所以随便改个名再传到虚拟主机上就可以了,..htaccess在linux下是个影藏文件。下面是url的具体映射
RewriteEngine On
RewriteRule ^/([a-z0-9A-Z]+/?)$ shop.do?username=$1
RewriteRule ^index/([a-z0-9A-Z]+).html$ index!$1.do
RewriteRule ^([a-z0-9A-Z]+).html$ $1.do
RewriteRule ^article/view/([0-9]+).html$ article!view.do?id=$1
RewriteRule ^article/view/([0-9]+).html$ article!list.do?typeId=$1
RewriteRule ^notice/view/([0-9]+).html$ notice!view.do?id=$1
RewriteRule ^group/([0-9]+).html$ group.do?id=$1
RewriteRule ^ticket/view/([0-9]+).html$ ticket!view.do?id=$1

你可能感兴趣的:(html,linux,windows)