How to configure htaccess file for Cake 2.3.x on 1 and 1 shared hosting

Sorry, I did a lot of searches without finding a solution to my problem.

Using the default htaccess file setting cakephp will not work in my domain when I want to install the Cakephp application in a subfolder while everything works on localhost (xampp)

target => http://mydomain.com/mycakeapp

Installation requires 3 htaccess files:

root.htaccess   

    # .htaccess in root
    
       Rewriteengine on
       Rewritebase / mycakeapp
       RewriteRule ^ $ app / webroot / [L]
       RewriteRule (.) App / webroot / $ 1 [L]
    
    
   in .htaccess application  
        
            Rewriteengine on
            Rewritebase / mycakeapp
            RewriteRule ^ $ app / webroot / [L]
            RewriteRule (.) App / webroot / $ 1 [L]
        
    
   in webroot.htaccess  
        
            Rewriteengine on
            Rewritebase / mycakeapp
            RewriteCond% {REQUEST_FILENAME}! -D
            RewriteCond% {REQUEST_FILENAME}! -F
            RewriteRule ^ (. *) $ Index.php [QSA, L]
        
    
After documenting cakephp and using these htaccess files, I get results with error 500. Using RewriteBase / instead of / mycakeapp produces a 404 error page.

php is in version 5.4 How can I solve this? Thank you very much for your help! Relations

+4
source share
2 answers

Set your rules as follows:

.htaccess at DOCUMENT_ROOT

RewriteEngine on
RewriteBase /
RewriteRule (.*) mycakeapp/$1 [L]

.htaccess in DOCUMENT_ROOT / mycakeapp

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

.htaccess DOCUMENT_ROOT/mycakeapp/app

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

.htaccess DOCUMENT_ROOT/mycakeapp/app/webroot

RewriteEngine On
RewriteBase /mycakeapp/app/webroot/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
+3

/dirCakePhp

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

/direCakePhp/

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

/direCakePhp//Webroot

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

Juste add '/' RewriteRule,

PHP 1and1 = > 5.2 date_default_timezone_set ('/'); core.php

+5

All Articles