Friday, October 28, 2011

Problem with redirect: CakePHP 2.0

This one is confusing me... I have installed Cake with no problems in
the past.... Here it is...

My URL is https://mydomain/forms/

When I type this in (using the real domain of course) I reach the
properly configured installation index page. All good.

Here is the issue..... Whenever I request a page from here out, I
must add index.php to the url. An example that properly lists the
records is this:

https://mydomain/forms/index.php/ifolders/

If I omit the index.php (https://mydomain/forms/ifolders/) I get the
infamous "Object not Found!" error. Typical redirect problem? Well..
I can't figure it out.

I am using OpenSuse 11.4 with an Apache2 server. Mod_redirect is
loaded because I see the redirection records in the log file. Oh
yes.. I turned on redirect logging.

Here are my configuration files:

(the include http.conf file):
--------------------------------------------------------------------------
Include /etc/apache2/conf.d/php5.conf

DocumentRoot /srv/www/ifolder-forms/app/webroot

RewriteLog /var/log/apache2/rewrite_forms_log
RewriteLogLevel 5

Alias /forms "/srv/www/ifolder-forms/app/webroot"
<Directory /srv/www/ifolder-forms/app/webroot>
AllowOverride All
Options FollowSymLinks Indexes MultiViews
Order allow,deny
Allow from all
DirectoryIndex index.html index.php
</Directory>

# comment out the following lines to remove the SSL requirement
LoadModule rewrite_module /usr/lib64/apache2/mod_rewrite.so
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/forms/(.*) https://%{SERVER_NAME}/forms/$1 [R,L]
--------------------------------------------------------------------------


The .htaccess file in app/webroot
--------------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase "/srv/www/ifolder-forms/app/webroot/"
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
--------------------------------------------------------------------------


The .htaccess in app (this one shouldn't matter since the DocumentRoot
was pointed to webroot)
--------------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase "/srv/www/ifolder-forms"
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
--------------------------------------------------------------------------

And finally, here is a sample from the redirect log (i scrubbed out
the domain reference and replaced it with mydomain):
--------------------------------------------------------------------------
10.25.1.154 - - [28/Oct/2011:15:13:14 --0400] [mydomain/
sid#7f49762ef090][rid#7f497653e420/initial] (3) [perdir /srv/www/
ifolder-forms/app/webroot/] add path info postfix: /srv/www/ifolder-
forms/app/webroot/index.php -> /srv/www/ifolder-forms/app/webroot/
index.php/ifolders/
10.25.1.154 - - [28/Oct/2011:15:13:14 --0400] [mydomain/
sid#7f49762ef090][rid#7f497653e420/initial] (3) [perdir /srv/www/
ifolder-forms/app/webroot/] strip per-dir prefix: /srv/www/ifolder-
forms/app/webroot/index.php/ifolders/ -> index.php/ifolders/
10.25.1.154 - - [28/Oct/2011:15:13:14 --0400] [mydomain/
sid#7f49762ef090][rid#7f497653e420/initial] (3) [perdir /srv/www/
ifolder-forms/app/webroot/] applying pattern '^(.*)$' to uri
'index.php/ifolders/'
10.25.1.154 - - [28/Oct/2011:15:13:14 --0400] [mydomain/
sid#7f49762ef090][rid#7f497653e420/initial] (4) [perdir /srv/www/
ifolder-forms/app/webroot/] RewriteCond: input='/srv/www/ifolder-forms/
app/webroot/index.php' pattern='!-d' => matched
10.25.1.154 - - [28/Oct/2011:15:13:14 --0400] [mydomain/
sid#7f49762ef090][rid#7f497653e420/initial] (4) [perdir /srv/www/
ifolder-forms/app/webroot/] RewriteCond: input='/srv/www/ifolder-forms/
app/webroot/index.php' pattern='!-f' => not-matched
10.25.1.154 - - [28/Oct/2011:15:13:14 --0400] [mydomain/
sid#7f49762ef090][rid#7f497653e420/initial] (1) [perdir /srv/www/
ifolder-forms/app/webroot/] pass through /srv/www/ifolder-forms/app/
webroot/index.php
10.25.1.154 - - [28/Oct/2011:15:13:16 --0400] [mydomain/
sid#7f49762ef090][rid#7f4976540430/initial] (3) [perdir /srv/www/
ifolder-forms/app/webroot/] add path info postfix: /srv/www/ifolder-
forms/app/webroot/ifolders -> /srv/www/ifolder-forms/app/webroot/
ifolders/add
10.25.1.154 - - [28/Oct/2011:15:13:16 --0400] [mydomain/
sid#7f49762ef090][rid#7f4976540430/initial] (3) [perdir /srv/www/
ifolder-forms/app/webroot/] strip per-dir prefix: /srv/www/ifolder-
forms/app/webroot/ifolders/add -> ifolders/add
10.25.1.154 - - [28/Oct/2011:15:13:16 --0400] [mydomain/
sid#7f49762ef090][rid#7f4976540430/initial] (3) [perdir /srv/www/
ifolder-forms/app/webroot/] applying pattern '^(.*)$' to uri 'ifolders/
add'
10.25.1.154 - - [28/Oct/2011:15:13:16 --0400] [mydomain/
sid#7f49762ef090][rid#7f4976540430/initial] (4) [perdir /srv/www/
ifolder-forms/app/webroot/] RewriteCond: input='/srv/www/ifolder-forms/
app/webroot/ifolders' pattern='!-d' => matched
10.25.1.154 - - [28/Oct/2011:15:13:16 --0400] [mydomain/
sid#7f49762ef090][rid#7f4976540430/initial] (4) [perdir /srv/www/
ifolder-forms/app/webroot/] RewriteCond: input='/srv/www/ifolder-forms/
app/webroot/ifolders' pattern='!-f' => matched
10.25.1.154 - - [28/Oct/2011:15:13:16 --0400] [mydomain/
sid#7f49762ef090][rid#7f4976540430/initial] (2) [perdir /srv/www/
ifolder-forms/app/webroot/] rewrite 'ifolders/add' -> 'index.php/
ifolders/add'
10.25.1.154 - - [28/Oct/2011:15:13:16 --0400] [mydomain/
sid#7f49762ef090][rid#7f4976540430/initial] (3) [perdir /srv/www/
ifolder-forms/app/webroot/] add per-dir prefix: index.php/ifolders/add
-> /srv/www/ifolder-forms/app/webroot/index.php/ifolders/add
10.25.1.154 - - [28/Oct/2011:15:13:16 --0400] [mydomain/
sid#7f49762ef090][rid#7f4976540430/initial] (2) [perdir /srv/www/
ifolder-forms/app/webroot/] trying to replace prefix /srv/www/ifolder-
forms/app/webroot/ with /srv/www/ifolder-forms/
10.25.1.154 - - [28/Oct/2011:15:13:16 --0400] [mydomain/
sid#7f49762ef090][rid#7f4976540430/initial] (5) strip matching
prefix: /srv/www/ifolder-forms/app/webroot/index.php/ifolders/add ->
index.php/ifolders/add
10.25.1.154 - - [28/Oct/2011:15:13:16 --0400] [mydomain/
sid#7f49762ef090][rid#7f4976540430/initial] (4) add subst prefix:
index.php/ifolders/add -> /srv/www/ifolder-forms/index.php/ifolders/
add
10.25.1.154 - - [28/Oct/2011:15:13:16 --0400] [mydomain/
sid#7f49762ef090][rid#7f4976540430/initial] (1) [perdir /srv/www/
ifolder-forms/app/webroot/] internal redirect with /srv/www/ifolder-
forms/index.php/ifolders/add [INTERNAL REDIRECT]
--------------------------------------------------------------------------

Any ideas on the problem?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: