> Hey everybody
>
> I never had to deploy a CakePHP app to a production server before, and
> now I'm a bit stuck.
>
> While my app works like a snap on my development machine, URL
> rewriting doesn't seem to work on the production server. This means:
> everything works fine as long as I access the app with myapp?
> url=controller/action, but myapp/controller/action doesn't work.
>
> First I remarked that there's no .htaccess file in htdocs. Maybe I
> have forgotten to check it into my Subversion (and didn't notice it
> because locally i'm using virtual hosts that point right to the app/
> webroot folder)? So I copied it from another live app, and it has the
> following content:
>
> <IfModule mod_rewrite.c>
> RewriteEngine on
> RewriteRule ^$ app/webroot/ [L]
> RewriteRule (.*) app/webroot/$1 [L]
> </IfModule>
>
> But sadly now I always get a 403 forbidden mesage! What could be the
> problem here?
The server probably either does not allow htaccess (AllowOverride
None) or mod_rewrite isn't enabled. If you can edit the virtual host
config, add the content of the htaccess file there. Your server will
be speedier if it doesn't have to deal with htaccess, in any case.
DocumentRoot /var/www/vhosts/your_site/app/webroot
<Directory "/var/www/vhosts/your_site/app/webroot">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
DirectoryIndex index.php index.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
</Directory>
--
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
1 comment:
Nice articel about Having a little trouble with url rewriting on production server , This article help me very well. Thank you. Also please check my article on my site Know All About Htaccess Tutorial. In link article we will learn about htaccess File.
Post a Comment