0
votes

I am running into an infinite redirection loop when setting up CakePHP on a bluehost server.

I have set my .htaccess as follows,

  1. Under /home/mysite/public_html/site2 (I have configured an add-on domain with site2 as its serving directory on BlueHost) <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule>
  2. Under /home/mysite/public_html/site2/app as, <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] </IfModule>
  3. And finally under /home/mysite/public_html/site2/app/webroot as, <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule>

If I remove the two RewriteCond from the .htaccess under webroot the Cake controllers start working but I don't see any images or CSS. I am not sure where am I going wrong.

1
You need to put a line RewriteBase /site2/ in public_html/site2/.htaccess and public_html/site2/app/webroot/.htaccess - Naveed Ramzan
tried that ...but it didn't work :( - Vishal

1 Answers

2
votes

creat a htaccess in root same as

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site2\.tld[NC]
RewriteRule    ^$ site2/app/webroot/    [L]
RewriteCond %{HTTP_HOST} ^site2\.tld[NC]
RewriteRule    (.*) site2/app/webroot/$1 [L]
</IfModule>`

and htacess in site2 folder must be

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