我想将localPHP-app从localhost部署到网络服务器,但我得到Error 500
。
我的文件夹结构如下所示(注意:Cake-app不在根目录中......)。 .htaccess
- 文件(0) - (3)符合this post [SO]:,因为这是CakePHP& Wordpress服务器,我尝试了this advice here, too [SO]。
该应用显然位于CAKEAPP
- 文件夹中,子域cakeapp.mydomain.com
指向该文件夹。
ROOT
├── .htaccess (0)
├── CAKEAPP
│ ├── .htaccess (1)
│ ├── app
│ │ ├── .htaccess (2)
│ │ ├── WEBROOT
│ │ │ ├── .htaccess (3)
├──{wordpress-files}
(0)。ROOT
文件夹中的.htaccess
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
中的.htaccess - 文件夹
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
(2)。ROOT/CAKEAPP/APP
中的.htaccess - 文件夹
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /app/
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
(3)。ROOT/CAKEAPP/APP/WEBROOT
中的.htaccess - 文件夹
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /app/webroot
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
答案 0 :(得分:4)
以下适用于mydomain.com/cakeapp
:
(0)。ROOT
文件夹中的.htaccess
#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
中的.htaccess - 文件夹
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /cakeapp
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
(2)。ROOT/CAKEAPP/APP
中的.htaccess - 文件夹
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /cakeapp
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
(3)。ROOT/CAKEAPP/APP/WEBROOT
中的.htaccess - 文件夹
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cakeapp
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
答案 1 :(得分:0)
我有两个项目一个主要项目运行良好,但现在我想在同一个域上运行另一个cakephp项目。
所以你在写作的地方,本教程将帮助你在子域上运行cakephp
RewriteEngine on RewriteBase / RewriteRule ^$ cake_sub_project/app/webroot/ [L] RewriteRule (.*) cake_sub_project/app/webroot/$1 [L]这两个新行需要添加到主.htaccess文件中。这里&#34; cake_sub_project&#34;是子项目
RewriteRule ^$ cake_sub_project/app/webroot/ [L] RewriteRule (.*) cake_sub_project/app/webroot/$1 [L]
现在转到您的子文件夹,确保您已更改以下目录中的.htacces。
cake_sub_project/ cake_sub_project/app cake_sub_project/webroot2.需要编辑/ httpdocs / cake_sub_project中的.htaccess,如下所示
RewriteEngine on RewriteBase /cake_sub_project/ RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L]
需要编辑来自/ httpdocs / cake_sub_project / app的.htaccess,如下所示
RewriteEngine on RewriteBase /cake_sub_project/app/ RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L]
需要编辑来自/ httpdocs / cake_sub_project / app / webroot的.htaccess,如下所示
RewriteEngine On RewriteBase /cake_sub_project/app/webroot/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]