all. This time I try cakephp, but I have got "URL rewriting is not properly configured on your server. 1) Help me configure it 2) I don't / can't use URL rewriting". I could know this is apache and .htaccess issues such as /etc/apache2/sites-avaliable/default and each directory .htaccess.
My development environment...
- Ubuntu12.04 on vmware fusion4
- apache2.2.22
- mysql5.5
- php5.3.10
- cakephp2.1
My process is followed...
1)/etc/apache2/httpd.conf
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
2)enabling mod_rewrite
sudo a2enmod rewrite
sudo service apache2 reload
3)editing /etc/apache2/sites-avaliable/default (AllOverride None to AllOverride All)
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
prompt: sudo service apache2 reload
4)editing or checking each .htaccess file ->cake root directory
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
->app root directory
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
->webroot directory
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
This issue is solved, thank you.
I had this problem as well. Turns out the .htaccess file was not getting copied alongside the cakePHP source. This is a common issue when using the cp command or not having hidden files visible in a file browser, unless you copy the top-level directory.
Doing a direct copy of the file to my project folder fixed it for me without having to mess with my apache settings.
cp ~/git/cakePHP/.htaccess ~/project/folder/
Possible missconfiguration:
Check if File http://your_domain_name/css/cake.generic.css
is rechable from your Browser. If not you will get the warning in the Default-Homepage
If you have a {HOME}/css
Directory at the root level, UrlRewriting will not redirect http://your_domain_name/css/cake.generic.css
to {HOME}/app/webroot/css/cake.generic.css
.
Thus the css-File will not be found, causing the Message that URL-rewriting is not properly configured. (Look at File app/View/Pages/home.cpt)
Solution: Completly remove {HOME}/css
Directory at root-level. Put your css-File at {HOME}/app/webroot/css
.
This could be a file permissions problem. Try recursively setting permissions to 777 for both the webroot and tmp directories. The tmp directory might require sudo.
sudo chmod -R 777 /path/to/app/webroot/
sudo chmod -R 777 /path/to/app/tmp/
来源:https://stackoverflow.com/questions/10835344/cakephp-doesnt-work-url-rewriting-on-ubuntu