URL访问

§   动态应用访问

动态应用访问时,后台应用和前台应用的格式一致,为:http://xxx.cmstop.dev/?app=应用名称&controller=控制器名称&action=方法名称

注意,在没有提供app/controller/action的情况下,系统会自动设置默认路由:

默认路由:

app                              system
controller                     index
action              index

如,访问guestbook前台index控制器index方法的URL为:

http://app.cmstop.dev/?app=guestbook&controller=index&action=index

也可写为:

  http://app.cmstop.dev/?app=guestbook

因为没有提供controlleraction时,路由默认策略设定 controller=index, action=index,所有两个URL访问结果一致。

同样的,访问guestbook后台index控制器index方法的URL:

http://admin.cmstop.dev/?app=guestbook&controller=index&action=index

也可写为:

  http://admin.cmstop.dev/?app=guestbook

如果直接访问:

http://admin.cmstop.dev/

实际上系统执行的是:

http://admin.cmstop.dev/?app=system&controller=index&action=index

§   静态内容访问

静态内容访问与常规访问一样,在URL后面使用完整的路径即可访问。

如:访问网站的一个内容页面,http://www.cmstop.dev/2011/0922/306.shtml

§   伪静态访问

CmsTop中,个人空间访问使用了伪静态的方式(内置),访问方式为:http://space.cmstop.dev/用户专栏ID

如:我的个人专栏编号为1,那么访问的URLhttp://space.cmstop.dev/1

个人空间对应的URL伪静态的规则为:

Apache:

RewriteEngine on
RewriteBase /
RewriteRule ^list(\/?)$ /index.php?action=listing [L]
RewriteRule ^([A-Za-z0-9]+)(\/?)$ /index.php?space=$1&action=homepage [L]
RewriteRule ^([A-Za-z0-9]+)/feed(\/?)$ /index.php?space=$1&action=rss [L]

Nginx:

rewrite ^([^\.]*)/list(/?)$ $1/index.php?action=listing last;
rewrite ^([^\.]*)/([A-Za-z\-0-9]+)/feed(/?)$ $1/index.php?space=$2&action=rss last;
rewrite ^([^\.]*)/([A-Za-z\-0-9]+)(/?)$ $1/index.php?space=$2&action=homepage last;



Copyright ©2009 - 2014 CmsTop.Com.All rights reserved.
思拓合众