Saturday, October 29, 2011

Re: Problem with redirect: CakePHP 2.0

On Oct 28, 2011, at 14:25, Mike wrote:

> 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.

It sure does sound like the typical behavior when mod_rewrite isn't installed or is not configured correctly.


> 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>
> --------------------------------------------------------------------------

This doesn't look like what's in CakePHP's repository:

https://github.com/cakephp/cakephp/blob/master/app/webroot/.htaccess

Specifically:

RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

Note the "?"

Finally, I'd forget .htaccess files completely; just move that code into your http.conf and turn off .htaccess processing; it'll speed up your server slightly.


--
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: