gpt4 book ai didi

cakephp - 如何从 url cakephp 中删除 index.php

转载 作者:行者123 更新时间:2023-12-02 21:57:26 24 4
gpt4 key购买 nike

我已经在 Cakephp 2.3 上构建了一个 web 应用程序..在我的 locaLhost 上所有 url 都很好..我可以像这样访问我的 url

http://localhost/Cakephp

但是现在当我将网站上传到服务器的根文件夹中时...我无法像这样访问我的网址

http://www.myweb.com

相反,它可以像这样访问

http://www.myweb.com/index.php/login

我认为可能有问题的是我的 app/webroot 文件夹中的 .htaccess 文件

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

我认为这种index.php导致了问题..因为我不了解.htaccess,所以不知道如何删除它。

如何从我的网址中获取index.php?

最佳答案

那么,应该没问题吧?您已经有 mod_rewrite 了吗?

如果 mod_rewrite 正确加载,.htaccess 文件就位,并且 index.php 仍然出现在链接中,那么很可能是问题使用 core.php 框架配置文件。

问题原因

就我而言,这是 App.baseUrl 配置选项的问题:

Configure::write('App.baseUrl', env('SCRIPT_NAME'));

解决问题

以下是我如何通过注释掉 core.php 中的以下行来解决该问题(以及其他一些带有重定向的问题):

// Configure::write('App.baseUrl', env('SCRIPT_NAME'));

关于cakephp - 如何从 url cakephp 中删除 index.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17519443/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com