的.htaccess / mod_rewrite.c:在根文件夹承载一个字preSS安装的子目录下,CakePHP的应用 [英] .htaccess / mod_rewrite.c : CakePHP application in a subfolder where the root folder hosts a Wordpress installation

查看:211
本文介绍了的.htaccess / mod_rewrite.c:在根文件夹承载一个字preSS安装的子目录下,CakePHP的应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从本地主机到网络服务器部署我CakePHP的应用程序内,但我得到错误500

我的文件夹结构如下所示(注:蛋糕应用程序是没有根...)。该的.htaccess -files (0) - (3)根据的这个帖子[SO]:和因为这是一个CakePHP的&放大器;字preSS服务器,我试过<一个? href="http://stackoverflow.com/questions/6910610/cakephp-application-in-a-sub-folder-and-word$p$pss-in-root-how-to-modify-htacces?rq=1">this建议在这里,太[SO] 。 该应用程序显然是位于 CAKEAPP - 文件夹,其中一个子 cakeapp.mydomain.com 点。

  ROOT
├──的.htaccess(0)
├──CAKEAPP
│├──的.htaccess(1)
│├──应用程序
││├──的.htaccess(2)
││├──WEBROOT
│││├──的.htaccess(3)
├──{字preSS-文件}
 


(0)的.htaccess中的 ROOT 文件夹

 动作的PHP / CGI-php52 / PHP
AddHandler的php52的.php
#BEGIN字preSS
&LT; IfModule mod_rewrite.c&GT;
RewriteEngine叙述上
的RewriteBase /
重写规则^指数\ .PHP $  -  [L]
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则。的index.php [L]
&LT; / IfModule&GT;

#结束字preSS

php_value memory_limit的128M

#BEGIN图片上传HTTP错误修复
&LT; IfModule mod_security.c&GT;
&LT;文件异步upload.php的&GT;


&LT; /文件&GT;
&LT; / IfModule&GT;
&LT; IfModule security_module&GT;
&LT;文件异步upload.php的&GT;


&LT; /文件&GT;
&LT; / IfModule&GT;
&LT; IfModule security2_module&GT;
&LT;文件异步upload.php的&GT;


&LT; /文件&GT;
&LT; / IfModule&GT;
#END图片上传HTTP错误修复
 


(1)的.htaccess中的 CAKEAPP - 文件夹

 &LT; IfModule mod_rewrite.c&GT;
RewriteEngine叙述上
的RewriteBase /
重写规则^ $应用程序/ Web根目录/ [L]
重写规则(。*)的应用程序/ Web根目录/ $ 1 [L]
&LT; / IfModule&GT;
 


(2)的.htaccess中的 ROOT / CAKEAPP / APP - 文件夹

 &LT; IfModule mod_rewrite.c&GT;
RewriteEngine叙述上
的RewriteBase / APP /
重写规则^ $ Webroot公司/ [L]
重写规则(。*)根目录/ $ 1 [L]
&LT; / IfModule&GT;
 


(3)的.htaccess中的 ROOT / CAKEAPP / APP / WEBROOT - 文件夹

 &LT; IfModule mod_rewrite.c&GT;
RewriteEngine叙述上
的RewriteBase /应用程序/ Web根目录
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{} REQUEST_FILENAME!-f
重写规则^(。*)$的index.php [QSA,L]
&LT; / IfModule&GT;
 

解决方案

对于以下作品 mydomain.com/cakeapp <​​/ code>:

(0)的.htaccess中 ROOT 文件夹

  #Action PHP / CGI-php52 / PHP
#AddHandler php52的.php

#BEGIN字preSS
&LT; IfModule mod_rewrite.c&GT;
 RewriteEngine叙述上
 的RewriteBase /
 重写规则^ cakeapp /(.*)$ / cakeapp / $ 1 [L,QSA]
 重写规则^指数\ .PHP $  -  [L]
 的RewriteCond%{} REQUEST_FILENAME!-f
 的RewriteCond%{} REQUEST_FILENAME!-d
 重写规则。的index.php [L]
&LT; / IfModule&GT;
#结束字preSS
 

(1)的.htaccess中的 CAKEAPP - 文件夹

 &LT; IfModule mod_rewrite.c&GT;
 RewriteEngine叙述上
 的RewriteBase / cakeapp
 重写规则^ $应用程序/ Web根目录/ [L]
 重写规则(。*)的应用程序/ Web根目录/ $ 1 [L]
&LT; / IfModule&GT;
 

(2)的.htaccess中的 ROOT / CAKEAPP / APP - 文件夹

 &LT; IfModule mod_rewrite.c&GT;
 RewriteEngine叙述上
 的RewriteBase / cakeapp
 重写规则^ $ Webroot公司/ [L]
 重写规则(。*)根目录/ $ 1 [L]
&LT; / IfModule&GT;
 

(3)的.htaccess中的 ROOT / CAKEAPP / APP / WEBROOT - 文件夹

 &LT; IfModule mod_rewrite.c&GT;
 RewriteEngine叙述上
 的RewriteBase / cakeapp
 的RewriteCond%{} REQUEST_FILENAME!-d
 的RewriteCond%{} REQUEST_FILENAME!-f
 重写规则^(。*)$的index.php [QSA,L]
&LT; / IfModule&GT;
 

I'd like to deploy my CakePHP-app from localhost to the webserver, but I get Error 500.

My Folder structure looks like this (note: the Cake-app is not in the root...). The .htaccess-files (0) - (3) are according to this post [SO]:, and as this is a CakePHP&Wordpress server, I tried this advice here, too [SO]. The app is obviously located in the CAKEAPP-Folder, where a subdomain cakeapp.mydomain.com points at.

ROOT
├── .htaccess (0)
├── CAKEAPP
│   ├── .htaccess (1)
│   ├── app
│   │   ├── .htaccess (2)
│   │   ├── WEBROOT
│   │   │   ├── .htaccess (3)
├──{wordpress-files}


(0) .htaccess in the ROOT FOLDER

    Action php /cgi-php52/php
AddHandler php52 .php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

php_value memory_limit "128M"

#BEGIN Image Upload HTTP Error Fix
<IfModule mod_security.c>
<Files async-upload.php>


</Files>
</IfModule>
<IfModule security_module>
<Files async-upload.php>


</Files>
</IfModule>
<IfModule security2_module>
<Files async-upload.php>


</Files>
</IfModule>
#END Image Upload HTTP Error Fix


(1) .htaccess in the CAKEAPP-Folder

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>


(2) .htaccess in the ROOT/CAKEAPP/APP-Folder

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /app/
RewriteRule    ^$    webroot/    [L]
RewriteRule    (.*) webroot/$1    [L]
</IfModule>


(3) .htaccess in the ROOT/CAKEAPP/APP/WEBROOT-Folder

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

解决方案

The following works for mydomain.com/cakeapp:

(0) .htaccess in ROOT FOLDER

#Action php /cgi-php52/php
#AddHandler php52 .php

# BEGIN WordPress
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^cakeapp/(.*)$ /cakeapp/$1 [L,QSA]
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
</IfModule>
# END WordPress

(1) .htaccess in the CAKEAPP-Folder

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteBase /cakeapp
 RewriteRule ^$ app/webroot/ [L]
 RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

(2) .htaccess in the ROOT/CAKEAPP/APP-Folder

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteBase /cakeapp
 RewriteRule ^$ webroot/ [L]
 RewriteRule (.*) webroot/$1 [L]
</IfModule>

(3) .htaccess in the ROOT/CAKEAPP/APP/WEBROOT-Folder

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

这篇关于的.htaccess / mod_rewrite.c:在根文件夹承载一个字preSS安装的子目录下,CakePHP的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆