.htaccess / mod_rewrite.c : CakePHP application in a subfolder where the root folder hosts a Wordpress installation

前端 未结 2 1267
悲&欢浪女
悲&欢浪女 2021-01-20 21:28

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

2条回答
  •  悲&欢浪女
    2021-01-20 21:39

    The following works for mydomain.com/cakeapp:

    (0) .htaccess in ROOT FOLDER

    #Action php /cgi-php52/php
    #AddHandler php52 .php
    
    # BEGIN WordPress
    
     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]
    
    # END WordPress
    

    (1) .htaccess in the CAKEAPP-Folder

    
     RewriteEngine on
     RewriteBase /cakeapp
     RewriteRule ^$ app/webroot/ [L]
     RewriteRule (.*) app/webroot/$1 [L]
    
    

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

    
     RewriteEngine on
     RewriteBase /cakeapp
     RewriteRule ^$ webroot/ [L]
     RewriteRule (.*) webroot/$1 [L]
    
    

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

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

提交回复
热议问题