wamp本地环境为静态与lnmp集成环境下nginx为zencart的静态配置
wamp本地环境为静态配置篇:第一步:找到Apache安装目录下httpd.conf这个文件,搜索找到,“LoadModulerewrite_module modules/mod_rewrite.so”,找到这一行,去掉前面的“#”;
第二步:找到AllowOverride None”改为
AllowOverride All.第三步:重启apache
第四步:新建.haccess文件,放在当前网站根目录下,在.haccess文件中写伪静态规则,看示例
RewriteEngine on
RewriteBase /
RewriteRule ^article\.html$ /article.php
RewriteRule ^article\_(+)\.html$/article.php?page=$1
到此就完成了。
nginx服务器为静态配置:
LNMP默认添加了Discuz、Wordpress、Sablog、emlog、dabr等伪静态支持,在新建虚拟主机时,输入以上名称就能 对上述程序伪静态完美支持。
如果,您还需要添加自定义伪静态规则,直接输入一个你想要的伪静态规则的名称,然后编辑/usr/local/nginx /conf/你自定义的伪静态名字.conf 里面添加伪静态规则。
在这里记录下我本人以前添加的一个关于zencart的记录:
在安装lnmp环境的时候写的一个为静态文件名称是叫other.conf;
所以就要在/usr/local/nginx/conf/下添加other,conf这个为静态规则文件;
内容如下:
location / {
if (!-e $request_filename)
{
#————————zen-cart start——————
# From Ultimate SEO URLs
rewrite "^(.*)-p-(.*).html" /index.php?main_page=product_info&products_id=$2&% last;
rewrite "^(.*)-c-(.*).html" /index.php?main_page=index&cPath=$2&% last;
rewrite "^(.*)-m-(+).html" /index.php?main_page=index&manufacturers_id=$2&% last;
rewrite "^(.*)-pi-(+).html" /index.php?main_page=popup_image&pID=$2&% last;
rewrite "^(.*)-pr-(+).html" /index.php?main_page=product_reviews&products_id=$2&% last;
rewrite "^(.*)-pri-(+).html" /index.php?main_page=product_reviews_info&products_id=$2&% last;
# For Open Operations Info Manager
rewrite "^(.*)-i-(+).html" /index.php?main_page=info_manager&pages_id=$2&% last;
# For dreamscape’s News & Articles Manager
rewrite "^news/?" /index.php?main_page=news&% last;
rewrite "^news/rss.xml" /index.php?main_page=news_rss&% last;
rewrite "^news/archive/?" /index.php?main_page=news_archive&% last;
rewrite "^news/({4})-({2})-({2}).html" /index.php?main_page=news&date=$1-$2-$3&% last;
rewrite "^news/archive/({4})-({2}).html" /index.php?main_page=news_archive&date=$1-$2&% last;
rewrite "^news/(.*)-a-(+)-comments.html" /index.php?main_page=news_comments&article_id=$2&% last;
rewrite "^news/(.*)-a-(+).html" /index.php?main_page=news_article&article_id=$2&% last;
# All other pages
# Don’t rewrite real files or directories
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
rewrite "^(.*).html" /index.php?main_page=$1&% last;
#—————————-zen-cart end—————–
}
}
差不多就是这些了。
有疑问欢迎大家交流,更欢迎高手拍砖。
版权声明:本文为博主原创文章,未经博主允许不得转载。
页:
[1]