本文介绍了.htaccess/mod_rewrite.c :CakePHP 应用程序位于子文件夹中,其中根文件夹承载 Wordpress 安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的 CakePHP 应用程序从本地主机部署到网络服务器,但我收到 Error 500.

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

我的文件夹结构看起来像这样(注意:Cake-app 不在根目录中......)..htaccess-files (0) - (3) 根据 这篇文章 [SO]:,由于这是一个 CakePHP&Wordpress 服务器,我尝试了 这里也有这个建议 [SO].该应用程序显然位于 CAKEAPP 文件夹中,子域 cakeapp.mydomain.com 指向该文件夹.

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) ROOT 文件夹中的 .htaccess


(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) CAKEAPP-Folder

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

(2) ROOT/CAKEAPP/APP-Folder

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

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


(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>

推荐答案

以下适用于 mydomain.com/cakeapp:

(0) ROOT 文件夹中的 .htaccess

(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) CAKEAPP-Folder

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

(2) ROOT/CAKEAPP/APP-Folder

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

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

(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 :CakePHP 应用程序位于子文件夹中,其中根文件夹承载 Wordpress 安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 22:32