问题描述
抱歉,我做了很多的搜索没有找到任何解决我的问题。
Sorry I made a lot of searches without finding any solutions to my problem.
使用默认的CakePHP htaccess文件安装程序不会在我的领域工作,当我想安装一个子文件夹我的CakePHP的应用程序,而一切工作在本地主机(XAMPP)
Using the default cakephp htaccess file setup will not work on my domain when I want to install my Cakephp app in a subfolder, while everything works on localhost (xampp)
目标=> http://mydomain.com/mycakeapp
target => http://mydomain.com/mycakeapp
安装需要3 htaccess的文件:
Install needs 3 htaccess files :
根的.htaccess
root .htaccess
#.htaccess in root
RewriteEngine on
RewriteBase /mycakeapp
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.) app/webroot/$1 [L]
在应用程序的.htaccess
RewriteEngine on
RewriteBase /mycakeapp
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.) app/ webroot/$1 [L]
在根目录的.htaccess
RewriteEngine On
RewriteBase /mycakeapp
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
继CakePHP的文档,并使用这些htaccess的文件,我得到error500结果。使用的RewriteBase /而不是/ mycakeapp会抛出404错误页面。
Following cakephp documentation, and Using these htaccess files, I get error500 results.Using RewriteBase / instead of /mycakeapp will throw 404 error page.
PHP是在5.4版本我该如何解决这个问题?非常感谢您的帮助 !问候
php is in 5.4 versionHow can I solve this ?Many thanks for your help !Regards
推荐答案
设置你的规则是这样的:
Setup your rules like this:
的.htaccess中DOCUMENT_ROOT
RewriteEngine on
RewriteBase /
RewriteRule (.*) mycakeapp/$1 [L]
的.htaccess中DOCUMENT_ROOT / mycakeapp
.htaccess in DOCUMENT_ROOT/mycakeapp
RewriteEngine on
RewriteBase /mycakeapp/
RewriteRule (.*) app/webroot/$1 [L]
的.htaccess中DOCUMENT_ROOT / mycakeapp /应用程序
RewriteEngine on
RewriteBase /mycakeapp/app/
RewriteRule (.*) webroot/$1 [L]
的.htaccess中DOCUMENT_ROOT / mycakeapp /应用程序/ Web根目录
RewriteEngine On
RewriteBase /mycakeapp/app/webroot/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
这篇关于如何配置htaccess文件蛋糕2.3.x上的1and1共同主办的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!