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
基础教程推荐
- PHP 守护进程/worker 环境 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- HTTP 与 FTP 上传 2021-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- 使用 PDO 转义列名 2021-01-01