Thursday, June 28, 2012

Re: CakePhp 2.0: images, styles all break when installing in web server root

Is this a case of virtual hosting on this server and if yes, what is the document root. Because if your site in /test was working so I assume it was document root was good. Also what is the logs of apache complains about ?

On Thu, Jun 28, 2012 at 10:23 PM, Bob Bowen <sygsix@gmail.com> wrote:
Correction. It's not just the images that don't work. It's the whole web. Navigation, styles, you name it. Now when I click on News, it brings me to mywebb.com/news, and says it doesn't exist.

I'm going a bit nuts here. As I said, this all works fine when it's in a sub-directory. Why is putting it in the root directory so different?

It's not clear to me if I need to use mod_rewrite / .htaccess or if it's simply recommended. Because I don't think my provider is going to let me change this.

Any help on this much much appreciated.

Bob


On Thursday, June 28, 2012 10:15:37 PM UTC+2, Bob Bowen wrote:

I've had a cake 2.0 install running for some time on my hosted web server. I installed it in /test/cakephp. All was well. I didn't have to use .htaccess or anything. And I haven't messed with APP_DIR, ROOT or WEBROOT_DIR.

When using an Html->Image tage my images would have the path:

/test/cakephp/img/logo.png

Internally Cake did the "magic" that transforms "img" to "/test/cakephp/app/webroot/img", where it is physically located.

Now I've put my Cake install in the root of my webserver (/html) and my images and styles are all broken.

I am using all of the default Cake directory names - app, lib, plugins and vendors, and they are all in the web server root dir.

The page itself loads, so it seems the index.php in the root is working, it finds Cake, etc. But my images now have the path:

/img/logo.png

... and the "magic" has died. My server now seems to be looking for the images physically in /img, but of course they are actually in /app/webroot/img.

How can I fix this? I tried copying the default .htaccess, the one that comes with the Cake download, but my server chokes on it. Apparently I can't use .htaccess. I don't see any reference to mod_rewrite in phpinfo() so I gues my provider doesn't support it.

Ideally I would like to get this to work without using .htaccess or changing the DocumentRoot in my apache config. What I don't get is, in the index.php it says:

This file collects requests if: - no mod_rewrite is available or .htaccess files are not supported

Well, this seems to be my case. Is there anything special I need to do to get this working?

Any help?

Thanks!


On Thursday, June 28, 2012 10:15:37 PM UTC+2, Bob Bowen wrote:

I've had a cake 2.0 install running for some time on my hosted web server. I installed it in /test/cakephp. All was well. I didn't have to use .htaccess or anything. And I haven't messed with APP_DIR, ROOT or WEBROOT_DIR.

When using an Html->Image tage my images would have the path:

/test/cakephp/img/logo.png

Internally Cake did the "magic" that transforms "img" to "/test/cakephp/app/webroot/img", where it is physically located.

Now I've put my Cake install in the root of my webserver (/html) and my images and styles are all broken.

I am using all of the default Cake directory names - app, lib, plugins and vendors, and they are all in the web server root dir.

The page itself loads, so it seems the index.php in the root is working, it finds Cake, etc. But my images now have the path:

/img/logo.png

... and the "magic" has died. My server now seems to be looking for the images physically in /img, but of course they are actually in /app/webroot/img.

How can I fix this? I tried copying the default .htaccess, the one that comes with the Cake download, but my server chokes on it. Apparently I can't use .htaccess. I don't see any reference to mod_rewrite in phpinfo() so I gues my provider doesn't support it.

Ideally I would like to get this to work without using .htaccess or changing the DocumentRoot in my apache config. What I don't get is, in the index.php it says:

This file collects requests if: - no mod_rewrite is available or .htaccess files are not supported

Well, this seems to be my case. Is there anything special I need to do to get this working?

Any help?

Thanks!

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: