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 8447947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:18:01+00:00 2026-06-10T10:18:01+00:00

I have to run my CakePHP 2.1 application in an environment with CGI-PHP and

  • 0

I have to run my CakePHP 2.1 application in an environment with CGI-PHP and without the ability to declare apache aliases. I want to redirect requests to a subdomain to CakePHP with mod_rewrite, but this doesn’t work out.

Current setup

  • Webroot is ~/user/public_html
  • CakePHP is in ~/user/public_html/cakephp/
  • CakePHP should be requested at dev.mydomain.tld

What I have until now is this (all paths relative to webroot):

  • ~/user/public_html/.htaccess

    RewriteEngine on
    Options +FollowSymlinks
    RewriteCond %{HTTP_HOST} ^(www\.)?dev\.mydomain.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/cakephp/app/webroot/ [NC]
    RewriteCond %{REQUEST_URI} !/$
    RewriteCond %{DOCUMENT_ROOT}/cakephp/app/webroot%{REQUEST_URI}/ -d
    RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R,L]
    RewriteCond %{HTTP_HOST} ^(www\.)?dev\.mydomain.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/cakephp/app/webroot/ [NC]
    RewriteRule ^(.*)$ /cakephp/app/webroot/$1 [L]
    
  • ~/user/public_html/cakephp/app/webroot/.htaccess

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
    

The Problem

Requests are somehow not routed correctly (the application runs without problems in my development environment with PHP as a module and an Virtual Host at the /cakephp/app/webroot/ level). When I request the home page at dev.mydomain.tld I only get an Error, Cake is telling me, that the CakephpController is missing.

Debug information

  • the interesting parts of $_SERVER debugged as the first line in /cakephp/app/webroot/index.php

      [REDIRECT_REDIRECT_REDIRECT_STATUS] => 200
      [REDIRECT_REDIRECT_STATUS] => 200
      [REDIRECT_HANDLER] => php-script
      [REDIRECT_STATUS] => On
      [HTTP_HOST] => dev.mydomain.tld
      [HTTP_CONNECTION] => keep-alive
      [SERVER_SOFTWARE] => Apache/2.2.21 (Unix)
      [SERVER_NAME] => dev.mydomain.tld
      [SERVER_ADDR] => 192.0.43.10
      [SERVER_PORT] => 80
      [DOCUMENT_ROOT] => /home/user/public_html
      [SCRIPT_FILENAME] => /home/user/public_html/cakephp/app/webroot/index.php
      [REDIRECT_URL] => /cakephp/app/webroot/index.php
      [GATEWAY_INTERFACE] => CGI/1.1
      [SERVER_PROTOCOL] => HTTP/1.1
      [REQUEST_METHOD] => GET
      [QUERY_STRING] => 
      [REQUEST_URI] => /
      [SCRIPT_NAME] => /cakephp/app/webroot/index.php
      [_PHP5_WORK_DIR] => /home/user/public_html/cakephp/app/webroot
      [PHP_SELF] => /
      [ORIG_PATH_INFO] => 
      [ORIG_PATH_TRANSLATED] => /home/user/public_html/cakephp/app/webroot/index.php
      [PATH_INFO] => /cakephp/app/webroot/index.php
    
  • the interesting parts of the CakeRequest object passed to the dispatcher:

      url => 'cakephp/app/webroot/index.php'
      base => '/cakephp'
      webroot => '/app/webroot/'
      here => '/cakephp/cakephp/app/webroot/index.php'
    

The question

So, what I don’t get here, is why the CakeRequest object has references to my folder structure while $_SERVER['REQUEST_URI'] == '/'. What would I have to do, to get this right? And in the first place, where should I look for the problem: in the mod_rewrite directives or in CakePHP itself?
I tried some things, including setting the RewriteBase in alle the .htaccess files and different settings for App.baseUrl in the Configuration object, but nothing seemed to help here.

I would be really thankful if somebody could give me a pointer on how to solve this problem.

  • 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-10T10:18:02+00:00Added an answer on June 10, 2026 at 10:18 am

    I would be really thankful if somebody could give me a pointer on how to solve this problem.

    Then I’ll give you a pointer as I don’t know the answer. 🙂

    Have you read this question where I had a problem quite similar to yours?

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

Sidebar

Related Questions

I want to run a web application on php and mysql, using the CakePHP
I am building a PHP application with CakePHP 2 . I need to have
I have run into a situation where I want to ensure that a compound
I have created a controllers called user_controller in my cakephp app. After I've run
I have an existing CakePHP that runs on a LAMP environment and need to
I have a cakephp application made by previous employees, its structure is defined as
I have a CakePHP script that should hopefully be run by a cron job.
The Problem I have a CakePHP application in which I call a stored procedure:
I'm trying to link two (and more) models in a CakePHP application. I have
I have huge troubles running my cakephp application now. after upgrading vom lenny to

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.