Cakephp problems with . htaccess

Asked

Viewed 217 times

0

I made the publication of the project, ran correctly, however, the other projects that were at the root stopped working, I checked and from what I noticed the problem is in . htaccess, which is so at the moment:

php_value date.timezone 'America/Sao_Paulo'
<IfModule mod_rewrite.c>
  RewriteEngine     on
  RewriteRule    ^image/(.*)\.[a-zA-Z]{2,4}$ app/webroot/thumb.php?$1 [QSA,L]

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

If I put the other projects inside the /webroot folder they work, but it gets URL /app/webroot/project

1 answer

1

I’m guessing that file is in the main directory (app) of your new project. Edited: Your htaccess is on the host root.

The .htaccess Voce posted is rewriting more Urls than it should.

Try changing this file to:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule    ^([^/]+)/image/(.*)\.[a-zA-Z]{2,4}$ $1/app/webroot/thumb.php?$2 [QSA,L]
  RewriteRule    ^([^/]+)$    $1/app/webroot/    [L]
  RewriteRule    ([^/]+)/(.*) $1/app/webroot/$2    [L]
</IfModule> 

The idea here is to capture the main directory of each project at the beginning of each URL and put before the app/webroot. The catch will be on $1 and what was previously in $1 gets into $2.

  • What’s in (app) is like this, this would be the root before the folder (app), it’s like directing everything based on the webroot folder of cake.

  • I updated my answer. Unfortunately I can’t test it, but I hope it takes you in the right direction.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.