使用 URL 重写 Pivotal 来扩展更大的应用程序

发布于 2024-08-02 07:37:42 字数 254 浏览 8 评论 0原文

我目前正在开发一个其基本结构类似于论坛的网站。我决定不选择使用已建立的 PHP 框架之一(我以前玩过 Rails),部分是为了学习,部分是因为我相信它们从长远来看会阻碍开发。

我想知道构建应用程序时 URL 重写有多重要。动态 URL 真的过时了吗?如果实现 URL 重写,那么也应该实现控制器吗?以后改用URL重写系统会不会很困难?

现在我只有模型和视图之间的分离,并且它可以很好地满足我的目的。尽量让事情变得简单,并随时添加。

你有什么想法?

I am currently working on a site which resembles a forum in its essential structure. I have decided not to opt for using one of the established PHP frameworks (I have played with Rails before), partially to learn, and also partially because I believe they hinder development in the long term.

I wanted to know how important URL rewriting becomes when building an app. Are dynamic URL's really out of fashion. If implementing URL rewriting should one also then just as well implement controllers? Would it be difficult to switch to a URL rewriting system later on?

Right now I only have a separation between Models and Views, and it's working fine for my purposes. Trying to keep things simple and add as I go.

What are your thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

终遇你 2024-08-09 07:37:42

我建议注意重写,但不要在开发时具体实现它。只要确保不创建神秘的 url,以后使用 mod_rewrite 添加应该相对容易。

特别是,我建议使用函数而不是字符串连接来构建链接。然后,当您实现漂亮的 URL 时,您可以轻松修改函数以返回重写的值,而不是实际路径。

I would suggest being mindful of rewriting, but don't specifically implement it as you develop. So long as you make sure not to create arcane urls, it should be relatively easy to add later using mod_rewrite.

In particular, I would recommend building links using a function rather than string concatenation. Then when you implement pretty URLs, you can easily modify the function to return the rewritten values, not the actual paths.

陪我终i 2024-08-09 07:37:42

URL 重写很好,因为它看起来更漂亮,并且使用户更容易看到他将要阅读的内容的内容(尽管无论如何这可能在标题中)。有些人认为出于 SEO 的原因重写更好。

尽管如此,重写对于大型应用程序来说并不是关键。我想说的是,没有死链接并使其易于查找内容才是关键,而不是 URL 有多漂亮。

如果说有什么的话,那就是“拥有就好”,实施起来相当简单——这就是为什么现在每个人都这样做的原因。

URL rewriting is nice because it looks prettier, and makes it a tad easier for the user to see what the content he's about to read is about (although that's probably in a header anyway). Some argue that rewriting is better for SEO reasons.

Still, rewriting is NOT pivotal for a large app. I'd say not having dead links and making it easy to find content is pivotal, not how pretty the URLs are.

If anything its just a "nice to have" that is fairly trivial to implement - that's why everyone is doing it these days.

怎樣才叫好 2024-08-09 07:37:42

请记住,对于许多用户来说,URL 是 Web 应用程序用户界面的重要组成部分。因此,URL 重写是提高站点可用性的重要工具。

Remember that URLs are an important part of the user interface of your web application for many users. So URL rewriting is an important tool for increasing the usability of your site.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文