Post by felixjsc » Thu Jan 24, 2013 4:53 pm

伪静态实现的原理就是 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

Newbie

Posts

Joined
Fri Jan 13, 2012 4:57 pm
Location - New York

Post by opencartchina » Thu Jan 31, 2013 11:32 am

你这只是使用htaccess文件来如此,对于大多数用户来讲不容易操作。
可以改造url_alias表,加上插件,让客户可以使用keyword时自己添加上.html后缀,也可以程序自动添加.html后缀,以此实现伪静态效果。

OpenCart中国(http://www.opencartchina.com)
OpenCart中文论坛:http://www.opencartchina.com/bbs
Email: opencartchina@qq.com
QQ: 1487063622
OpenCart技术交流QQ 1群:282797742
OpenCart技术交流QQ 2群:298317506
OpenCart技术交流QQ 3群:198384554
OpenCart技术交流QQ 4群:227297836
中国版MyCnCart官方QQ群:473071696


New member

Posts

Joined
Thu Jan 31, 2013 10:38 am

Post by arguskao » Sat Mar 08, 2014 9:18 am

我試了很多次,都失敗
不曉得哪裡操作錯了

Newbie

Posts

Joined
Sat Mar 08, 2014 9:17 am

Post by Felix_Ho » Mon Mar 10, 2014 9:40 am

你產品跟分類目錄那邊的SEO KEYWORD有輸入了嗎
admin>catalog > product > edit > data > seo keyword
admin>catalog > categories> edit > data > seo keyword

OpenCart®
PHP Developer.

更多中文教學在 OpenCart香港官方網站 !
QQ: 2039574815


Administrator

Posts

Joined
Fri Jun 01, 2012 2:35 pm
Who is online

Users browsing this forum: No registered users and 4 guests