Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Cakephp in a sub folder

I am a newbie to cakephp.I had a previous cakephp project in root folder (Ex: www.example.com), now I have moved the files to a sub-folder 'folder1' (Ex: www.example.com/folder1). The site is working, but the images and the other sub paths are pointing to the old root link.

The folder1 .htaccess

<Limit GET POST>
#require valid-user
</Limit>
<IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteBase /folder1/
        RewriteRule    ^$ app/webroot/    [L]
        RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

The folder1/app

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

The folder1/app/webroot

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /folder1/

    # Add trailing slash to urls
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{0,5})$
    RewriteRule ^(.*)([^/])$ $1$2/ [R=301,L]

    # Skip files and pass requests to cake
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

Sorry for my bad English.

Please can anyone help me solve this issue.

like image 998
ajayr1008 Avatar asked Jul 27 '26 08:07

ajayr1008


1 Answers

Try this, goto app/config/core.php and make changes to this line,

Configure::write('App.fullBaseUrl', 'http://localhost/folder1');

like image 193
hitesh shah Avatar answered Jul 30 '26 08:07

hitesh shah