为共享主机设置修复 cakephp .htaccess/mod_rewrite

fixing cakephp .htaccess/mod_rewrite for shared hosting setups(为共享主机设置修复 cakephp .htaccess/mod_rewrite)
本文介绍了为共享主机设置修复 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)