Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9278967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:30:48+00:00 2026-06-18T17:30:48+00:00

I have set up CakePHP on shared hosting, within a sub-directory (cakeDomain). Using htaccess

  • 0

I have set up CakePHP on shared hosting, within a sub-directory (cakeDomain). Using htaccess in the root directory (mainDomain), I have pointed another domain to it (cakeDomain), like so:

# /.htaccess
# cakeDomain redirect rules
RedirectMatch 301 ^/cakeDomain/$ http://cakeDomain.com/
# handle domain root and skip subfolders
RewriteCond %{HTTP_HOST} cakeDomain.com
RewriteCond %{REQUEST_URI} !^/cakeDomain/
RewriteCond %{REQUEST_URI} \..+$
RewriteRule ^(.*)$ cakeDomain/$1 [L]

# add trailing slash to subfolders (eg abc to: abc/)
RewriteCond %{HTTP_HOST} cakeDomain.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} [^/]$
RewriteRule ^(.*)$ $1/ [L,R=301]

# handle files in subfolders
RewriteCond %{HTTP_HOST} cakeDomain.com
RewriteCond %{REQUEST_URI} !^/cakeDomain/
RewriteRule ^(.*)$ cakeDomain/$1/ [L]

RewriteCond %{HTTP_HOST} www.mainDomain.com/cakeDomain/
RewriteRule %{HTTP_HOST} www.cakeDomain.com [L]

Visiting mainDomain.com/cakeDomain correctly redirects you to cakeDomain.com

CakePHP’s files are stored as so:

/cakeDomain/app/...
/cakeDomain/lib/...
/cakeDomain/...
etc.

Visiting cakeDomain.com brings up the correct front page but all of the links have the installed directory prepended to them:

cakeDomain.com/cakeDomain/controller/action/param1

Instead of:

cakeDomain.com/controller/action/param1

Any ideas how to fix this?

Please note, from my many searches, that it appears many people immediately suggest virtual hosts. This is not an option here; my hosting is a virtual host. I presume this solution requires htaccess and/or routing tricks. Thank-you in advance for any help you can provide.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T17:30:49+00:00Added an answer on June 18, 2026 at 5:30 pm

    Basically, you’re putting website B (Cake) inside the public web directory of website A (Maindomain).

    I would REALLY discourage you to do so because this way all ‘private’ CakePHP directories are also inside your public web directory (for example cakeDomain/app/tmp/logs/error.log). Please check properly if those locations are secured properly

    Dou you have access to the directories ‘outside’ your public webfoot?

    Having said that, this may be of help:
    http://cookingwithcakephp.blogspot.nl/2008/04/installing-cakephp-into-subdirectory.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site set up using CakePHP and MySQL and I want to
I have a RESTful API set up and working with CakePHP using mapResources() and
I have been using CakePHP at work and now I am trying to set
I am using CakePHP 2.2.1 I have a model which I have set var
I am using RPX in my CakePHP project. I have set the toke url
I am using CakePHP in PHP development. I have set my debug mode to
I have problem with cakephp's Session->write method. If I set a value like $_SESSION['..']
I have set up upload_max_filesize and post_max_size to 32Mb in php.ini. I am using
I have set up a datepicker in a form using the following js: $(#Expiry).datepicker({
Cakephp is giving me some problems as I have set as below (I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.