简体   繁体   中英

GoDaddy CakePHP subfolder .htaccess rules

I need to setup cakephp in the sub directory of my site - cms . I tried various .htaccess rules but I get error 500 and 404 error. I am on GoDaddy Deluxe Linux Hosting with cPanel.

Following is what I tried.

In CMS folder:

<IfModule mod_rewrite.c>
#Options +FollowSymlinks
RewriteEngine on
RewriteBase /cms/
#RewriteBase /mysite.com/cms/
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]
</IfModule> 

In CMS > App folder:

<IfModule mod_rewrite.c>
#Options +FollowSymlinks
RewriteEngine on
RewriteBase /cms/
#RewriteBase /mysite.com/cms/
RewriteRule    ^$    webroot/    [L]
RewriteRule    (.*) webroot/$1    [L]
</IfModule>

In CMS > App > Webroot:

<IfModule mod_rewrite.c>
#Options +FollowSymlinks
RewriteEngine On
RewriteBase /cms/
#RewriteBase /mysite.com/cms/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

Kindly help me get the working .htaccess rules.

You need to use proper RewriteBase .

Try:

In CMS > App folder:

<IfModule mod_rewrite.c>
#Options +FollowSymlinks
RewriteEngine on
RewriteBase /cms/app/

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

In CMS > App > Webroot:

<IfModule mod_rewrite.c>
#Options +FollowSymlinks
RewriteEngine On
RewriteBase /cms/app/webroot/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

Your /cms/.htaccess looks fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM