cakephp 中的 Mod 重定向

发布于 2024-08-26 17:08:29 字数 151 浏览 3 评论 0原文

我想在 cakephp 中使用 mod_rewrite 。当用户输入域名时,用户应重定向到 http://domain.com/index.html

I want to use mod_rewrite in cakephp. when user type domain name user should redirect to http://domain.com/index.html.

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

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

发布评论

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

评论(1

未蓝澄海的烟 2024-09-02 17:08:29

这取决于您的 CakePHP 位置:

如果它运行在 Web 服务器根目录的子目录中(通过 http:// domain.com/cakephp)你可以使用这个:

在默认控制器的默认操作中输入:

$this->redirect('http://domain.com/index.html')    

否则,如果 CakePHP 从服务器的根目录运行(通过 http://domain.com) 只是 webroot 内的 index.html,您不需要在代码中执行任何操作。

希望这会有所帮助。

That depends on your CakePHP location:

If it runs inside a directory that is a child of the webserver's root directory (accessed as http://domain.com/cakephp) you can just use this:

In the default action of your default controller put this:

$this->redirect('http://domain.com/index.html')    

Otherwise if CakePHP is running from the root of the server (accessed as http://domain.com) just but index.html inside webroot and you dont need to do anything in code.

Hope that will help.

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