设置opencart伪静态linux环境下比较容易,如果是PHP在IIS下跑的话,就蛋疼了,可能需要一些时间去研究,我多次也给网友提示使用LINUX主机,但是仍然有很多客户选择WINDOWS主机,可能是便宜吧。 伪静态实现的原理就是 index.php?act=about&cid=1 将这种形式的动态路径用 about-1.html 这种形式输出,根据不同的服务器环境,配置方法也不太一样,PHP+iis6的话就要配置httpd.ini文件,php+iis7就要配置web.config,PHP+apache就要配置.htaccess文件 .htaccess规则示例: RewriteEngine on RewriteRule ^/?(index|guestbook|online)\.html$ index\.php [L] RewriteRule ^/?(eindex)\.html$ index\.php?act=$1 [L] RewriteRule ^/?(index|guestbook|online)-([0-9]+).html$ index\.php\?p=$2 [L] RewriteRule ^/?([a-z0-9]+)_([0-9]+).html$ index\.php\?act=$1&id=$2 [L] RewriteRule ^/?([a-z0-9]+)-([0-9]+).html$ index\.php\?act=$1&cid=$2 [L] RewriteRule ^/?([a-z0-9]+)-([0-9]+)-([0-9]+).html$ index\.php\?act=$1&cid=$2&p=$3 [L] httpd.ini示例: [ISAPI_Rewrite] RepeatLimit 32 # Block external access to the httpd.ini and httpd.parse.errors files RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O] # Block external access to the Helper ISAPI Extension RewriteRule .*\.isrwhlp / [F,I,O] RewriteRule ^/(index|guestbook|online)\.html$ /$1\.php RewriteRule ^/(eindex).html$ /index\.php\?act=$1 RewriteRule ^/(index|guestbook|online)-([0-9]+).html$ /$1\.php\?p=$2 RewriteRule ^/([a-z0-9]+)_([0-9]+).html$ /index\.php\?act=$1&id=$2 RewriteRule ^/([a-z0-9]+)-([0-9]+).html$ /index\.php\?act=$1&cid=$2 RewriteRule ^/([a-z0-9]+)-([0-9]+)-([0-9]+).html$ /index\.php\?act=$1&cid=$2&p=$3 (责任编辑:好模板) |