Forewarning: i'm not great with Apache. Usually i can fumble my way around,
but it doesn't take much to throw me off.
i've done all my development using Cake's built-in server, and things have
been mostly smooth. i'm now working toward migrating to a LAMP server
(testing locally in Windows), starting with figuring out what configuration
differences there will be. i need this to be a VirtualHost config. Cake's
server Just Works (TM), but Apache is giving me migraines.
i have a set of Routes with prefix "admin", so anything from
/admin/whatever... is using /Controller/Admin/WhateverController. This Just
Works (TM) with the Cake server, but with Apache, it gives me various
errors, depending on config variations.
Before getting much further into the TL of this DR, i think i've discovered
*part* of the problem: i have an actual /webroot/admin directory where
CSS/IMG/JS assets for the Admin section of the site are held. There's no
index.php there, just the resources. It *appears* Apache is choking on this
directory. If i create /webroot/contact, it chokes on that as well. Without
the directory, the /contact URL displays correctly. The Cake server doesn't
seem to care that i have either /webroot/admin or /webroot/contact. So
there must be something wrong in my Apache config, but i can't seem to get
the right setup.
If that's enough to trigger some suggestions, great! PLEASE tell me what
stupid-simple thing i missed. If not, here's what i currently have...
*1. Virtual Host config:*<VirtualHost *:8008>
Define SITE_ROOT "C:/Sites/kodiakinvestmentsllc.com-cake3"
ServerName kodiak.local
DocumentRoot ${SITE_ROOT}
DirectoryIndex index.php
ErrorLog ${SITE_ROOT}/tmp/logs/error.log
CustomLog ${SITE_ROOT}/tmp/logs/debug.log combined
<Directory /webroot>
AllowOverride All
Order Allow,Deny
</Directory>
</VirtualHost>
*2. Routes*
Router::scope('/', function(RouteBuilder $routes) {
// Several routes defined here that work in Apache
});
Router::prefix('admin', function(RouteBuilder $routes){
$routes->connect('/:controller', ['action' => 'index'], ['routeClass'
=> 'InflectedRoute']);
$routes->connect('/:controller/:action/*', [], ['routeClass' =>
'InflectedRoute']);
$routes->connect('/login', ['controller' => 'Users', 'action' =>
'login']);
$routes->connect('/logout', ['controller' => 'Users', 'action' =>
'logout']);
$routes->connect('/', ['controller' => 'Admin', 'action' => 'index']);
});
*3. .htaccess**/.htaccess*
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
<FilesMatch ".(eot|ttf|otf|woff)">
Header Set Access-Control-Allow-Origin "*"
</FilesMatch>
AddType image/svg+xml .svg .svgz
*/webroot/.htaccess*
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REWRITE_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
*3. URLs*kodiak.local:8008/ : Works, shows Cake's system check page. (i
still have to work out a main index.)
kodiak.local:8008/contact : Works, uses route defined above in the '/'
scope. Other routes similar to this also work, so i know mod_rewrite is
doing some part of its job.
kodiak.local:8008/admin : Broken...
- It typically redirects to /webroot/admin and gives an error that
either i'm missing "WebrootController" (obviously wrong), or usually a 403
access forbidden to /webroot/admin.
- Cake's server correctly redirects to /admin/login and correctly lets
me log in and go to various /admin paths...
Let me know if more info is needed to figure out what i'm missing. i
appreciate all the help i've gotten here. :)
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.