0
votes

I have URL like :

localhost/admin/app/webroot

For this the css in default.ctp taken /app/webroot/css/style.css path. so my css is not loading.

Should I have to change .htaccess file for this ? There are 3 .htaccess file in project.

1) which is located in admin/.htaccess

RewriteEngine on

RewriteRule ^$ app/webroot/ [L]

RewriteRule (.*) app/webroot/$1 [L]

2) which is located in admin/app/.htaccess

RewriteEngine on

RewriteRule    ^$    webroot/    [L]

RewriteRule    (.*) webroot/$1    [L]

3) which is located in admin/app/webroot/.htaccess

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^ index.php [L]

please help to resolve my problem.

Thanks in advance.

2
can anyone help me ? - Hardik Deliwala
what you have written on your default.ctp - Abhishek
echo $this->Html->css('style'); - Hardik Deliwala

2 Answers

0
votes

The simplest way of dealing with this is to set your application up in "Production Mode" as described here

Essentially it means you point your document root to the /app/webroot directory of your Cake App, this makes everything really simple and means you can use the default .htaccess files to handle the rewriting.

If you are trying to put this into a subdirectory you might need to set the base for Rewrite to work on:

RewriteBase /admin

This also assumes you have mod_rewrite enabled on your server!

0
votes

I found the answer :

If we can add

Configure::write('App.base', '/admin/');

in bootstrap.php file then it works for me.

Thanks for your help.