Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a CakePHP project on Localhost

I have downloaded a CakePHP project from an online server and need to make it work locally, to do some changes. I'm facing a problem similar to this one and have tried all possible solutions, with no luck.

Here's the situations:

  • Site home is in localhost/xpto (c:\xampp\htdocs\xpto) -> here, the site appears unformatted (no CSS) and too slow.
  • If I access localhost/xpto/something, I get the site with the CSS, but some links wont work.

I have mod_rewrite loaded (phpinfo()) together with the 3 .htaccess files, but still experience this problem.

Is there any known issue that I can explore to fix my site? Please redirect me to any guides or tutorials that you may feel relevant to my issue

like image 907
paezinc Avatar asked Jul 12 '26 21:07

paezinc


1 Answers

Use RewriteBase directive in .htaccess.

e.g my dev space is on my localhost, is located in /home/ati/public_html/cakerbs, under a subdir in my userdir. The rewriteBase looks like as follows in the root of the cake:

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

in the app directory .htacces:

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

in the webroot directory:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /~ati/cakerbs
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
like image 158
sipiatti Avatar answered Jul 14 '26 12:07

sipiatti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!