Hi all!
>From CakePHP manual and wiki it looks we have no other choice then
apache webserver, if we want to have nice URLs. Don't worry, it is not
true. There are couple of options and I want to share with You
configuration snippets for 'nice URLs' with production install of
CakePHP at 2 nice webservers. I will assume You have Cherokee webserver
or lighttpd installed on Your system and it works with php (both of
them are able run php as cgi or fastcgi).
Let's prepare:
--------------------------------------------------------------------------------------------------------
Sample directory structure:
# Here is CakePHP distro (dirs 'app', 'cake', 'vendors').
# Files .htaccess and index.php arent' needed.
/usr/local/lib/cakephp
# Here are copied subdirectories of 'app' directory for example virtual
host.
# Files app/.htaccess, app/index.php and app/webroot/.htaccess arent'
needed.
# HERE Your app will live (controllers, models...), if You don't
touched bootstrap.php ;)
/usr/local/www/servers/www.example.com/app
--------------------------------------------------------------------------------------------------------
Change constant CAKE_CORE_INCLUDE_PATH in file
/www/servers/www.example.com/app/webroot/index.php to
define('CAKE_CORE_INCLUDE_PATH', '/usr/local/lib/cakephp');
--------------------------------------------------------------------------------------------------------
===>>> Cherokee Web Server from http://www.0x50.org/
Snippet from file /usr/local/etc/cherokee/www.example.com :
#---------------------------------------------------------------------------------------------------------
Server www.example.com {
DocumentRoot /www/servers/www.example.com/app/webroot
...
Directory /css, /files, /img, /js {
Handler common
...
}
Directory / {
Handler redir {
Rewrite "/(.*)$" "/index.php?url=$1"
}
....
}
...
}
#---------------------------------------------------------------------------------------------------------
===>>> lighttpd from http://www.lighttpd.net/
Snippet from file /usr/local/etc/lighttpd.conf :
#---------------------------------------------------------------------------------------------------------
server.modules = (
"mod_rewrite",
"mod_simple_vhost"
...
)
...
simple-vhost.server-root = "/usr/local/www/servers/"
simple-vhost.default-host = "www.example.com"
simple-vhost.document-root = "/app/webroot/"
...
url.rewrite-once = (
"/(.*)\.(.*)" => "$0",
"/(css|files|img|js)/" => "$0",
"^/([^.]+)$" => "/index.php?url=$1"
)
...
#---------------------------------------------------------------------------------------------------------
Enjoy! :)
P.S.
- if You have CakePHP worked on other web server with some rewrite
trick, let us know, please
- if You speak English better then me, write some nice wiki article
about it, please
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---