使用新 url 迁移系统
我正在将系统从 MVC 切换到自定义代码系统。目前我们正在使用这种格式的 url:
index.php?part=CAPACITOR&type=CERAMIC&model=0805&page=spec
我现在需要重写 url,以便对用户来说更加友好,例如
mysitecom/CAPACITOR/
mysitecom/CAPACITOR/CERAMIC/
mysitecom/CAPACITOR/CERAMIC/0805/spec.html#2
#1 和 #2 是在 jquery 中加载的页面。开发人员使用旧方法使用 /index.php/CAPACITOR/CERAMIC/0805/spec.html
因为我认为在 url 中使用 index.php 不好,我该怎么做才能使它更好?
I am switching system from a MVC to a custom code system. Currently we are using this format for urls:
index.php?part=CAPACITOR&type=CERAMIC&model=0805&page=spec
I need now to rewrite urls like to be more nice for user like
mysitecom/CAPACITOR/
mysitecom/CAPACITOR/CERAMIC/
mysitecom/CAPACITOR/CERAMIC/0805/spec.html#2
where #1 and #2 are the pages loaded in jquery. The developer use the old way using /index.php/CAPACITOR/CERAMIC/0805/spec.html
Because I don't think using the index.php in the url is good, what can I do to make this better?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是您需要使用的内容
因此,当未提供文件夹(例如陶瓷)时,您可以添加一个标志来加载所有文件夹,模型的想法相同。这意味着如果仅提供第一部分,则仅使用第一条规则。默认情况下,从
page.html
开始,您可以加载索引。现在,
a-z0-9\-_
仅表示任何字母、数字、破折号和下划线。如果您愿意,可以使用([^/]+)
,这样可以使用更多字符。L 表示
last
,表示如果规则匹配,它将停止。 NC 表示非大小写,因此 A = a 或 ABC = abc。Here's what you need to use
So when a folder (example CERAMIC) is not provided you can add a flag to load all, same idea for model. It means that if only the first part is provided only he first rule will be used. As of the
page.html
by default you can load the index.Now,
a-z0-9\-_
means any letters, numbers, dashes and underscore ONLY. You can use([^/]+)
if you prefer that will allow you to use more characters.The L mean
last
meaning if the rule match, it will stop. NC means non case so A = a or ABC = abc.