fixing cakephp .htaccess/mod_rewrite for shared hosting setups(为共享主机设置修复 cakephp .htaccess/mod_rewrite)
问题描述
我正在尝试在共享主机设置上安装 cakePHP.将文件解压缩到 ~/public_html/dev/cake 之类的位置并访问相应的 URL(在本例中为 http://hostname/~username/dev/cake/),我收到 404 错误:<小时>未找到
I'm trying to install cakePHP on a shared hosting setup. After extracting the files to a location like ~/public_html/dev/cake and visiting the appropriate URL (in this case http://hostname/~username/dev/cake/), I receive a 404 error:
Not Found
在此服务器上找不到请求的 URL/usr/home/username/public_html/dev/cake/app/webroot/.
The requested URL /usr/home/username/public_html/dev/cake/app/webroot/ was not found on this server.
我怀疑这是因为经过仔细检查,~/public_html的绝对路径实际上不是/usr/home/username/public_html,而是/usr/www/users/username/.
I suspect that the reason for this is that upon closer inspection, the absolute path to ~/public_html is not in fact /usr/home/username/public_html, but rather /usr/www/users/username/.
这是我一直在尝试的(但显然它不起作用):(~/public_html/dev/cake/app/webroot/.htaccess)
Here's what I've been trying (but obviously it's not working): (~/public_html/dev/cake/app/webroot/.htaccess)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /usr/www/users/username/dev/cake/app/webroot/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
不幸的是,这似乎没有任何改变(404 消息保持不变).想法?
Unfortunately, this doesn't seem to change anything (the 404 message remains that same). Thoughts?
推荐答案
不应该
RewriteBase /usr/www/users/username/dev/cake/app/webroot/
成为
RewriteBase /~username/dev/cake/
RewriteBase
关心将真实网址映射到虚拟网址,我认为这就是您想要的.
RewriteBase
cares about mapping real urls to virtual ones, and I think that's what you want.
这篇关于为共享主机设置修复 cakephp .htaccess/mod_rewrite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为共享主机设置修复 cakephp .htaccess/mod_rewrite


- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01