First a little background.
I using Nearly Free Speech as my webhost for multiple sub-domains.
Each sub-domain is contained within a separate directory within the
root web directory.
e.g.
/
-www.felixfennell.co.uk
-cake.felixfennell.co.uk
-help.felixfennell.co.uk
I then use the following mod_rewrite rules to make a request for;
http://www.felixfennell.co.uk/non_existent_page.php get the file
from; /www.felixfennell.co.uk/non_existent_page.php.
This all works fine and how I would expect except when I try to use
cake, or more specifically the URLs it creates.
I have a cake app setup in a subdomain (help.felixfennell.co.uk - I
know there are errors with the home page).
If I manually enter or create a link to: http://help.feixfennell.co.uk/controller/action
it works as expected.
However if I linked to the same thing using the HTML helper it would
generate this URL: http://help.felixfennell.co.uk/help.felixfennell.co.uk/controller/action.
I can't work out why its doing this, in the webroot/index.php file I
have this
/**
* The full path to the directory which holds "app", WITHOUT a
trailing DS.
*
*/
if (!defined('ROOT')) {
define('ROOT', $_SERVER['DOCUMENT_ROOT'] .
'help.felixfennell.co.uk');
}
I thought at first it was repeating the help.felixfennell.co.uk bit
because the above setting, however If I alter that to just
$_SERVER['DOCUMENT_ROOT'] I get a whole load of errors (which I expect
to happen as there is nothing but the folders holding each site at /).
I also tried seeing what the various php server variables where for a
page in my app, these are the results;
PAGE URL: http://help.felixfennell.co.uk/help.felixfennell.co.uk/articles/view/4c20add8-7858-4974-aaca-44a4ac110103
(as generated by cake, note the repeating domain name).
TEST START
help.felixfennell.co.uk [server name]
/f5/fwf/public/ [document root]
/f5/fwf/public/ [NFSN_SITE_ROOT]
help.felixfennell.co.uk [http_host]
/f5/fwf/public/help.felixfennell.co.uk/app/webroot/index.php [script
filename]
TEST END
and here is the code for the same test;
<p><?php echo($_SERVER['PHP_SELF']); ?> [php self]</p>
<p><?php echo($_SERVER['SERVER_NAME']); ?> [server name]</p>
<p><?php echo($_SERVER['DOCUMENT_ROOT']); ?> [document root]</p>
<p><?php echo($_SERVER['DOCUMENT_ROOT']); ?> [NFSN_SITE_ROOT]</p>
<p><?php echo($_SERVER['HTTP_HOST']); ?> [http_host]</p>
<p><?php echo($_SERVER['SCRIPT_FILENAME']); ?> [script filename]</
p>
So my question is: Where is cake getting the base URL for the links it
creates? - php is giving the correct info so I don't know why cake is
making these strange URLs.
I have made absolutely no alterations to anything in the /cake
directory. I have moved this location into a protected directory my
host provides for this type of thing, this works fine (I've made the
modifications to the same index.php file as per the cookbook). The
same problem occurs if I put cake in the same directory as /app.
Sorry for such a long question but I wanted to be as clear as possible
(probably left out something obvious though!).
Can anybody help?
- Felix
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment