0

I'm new using cakephp, and I'm trying to set Friendly URLs for my site, but I'm having problems.

I've already made all the steps that the cakephp 2.3 Book says, and my apache configuration says that the mod_rewrite is being executed.

And when I enter the main page of cake, it says that the URL rewriting is not configured, and when I want to acces to my web I need to go throught www.mysite.com/index.php/controller/function and of course, i want this: www.mysite.com/controller/function, and if I try this route, it says that is not found in my server (and I have the controller and function created).

This are my .htacces files:

root directory:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

App 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 [QSA,L]
</IfModule>
Musa
  • 96,336
  • 17
  • 118
  • 137
  • 1
    Is this on a local M/W/LAMP server or is it on some paid for web-hosting? If it's an Apache installation you set up yourself then you might want to check the config to make sure `AllowOverride All` is set for the virtual host. However, if it's paid-for hosting then this will probably have alreay been set by the provider. – Joseph Mar 26 '13 at 03:19
  • It's on my own ubuntu server, I've entered in the apache2.conf file (because I read in the web that the config is here, not in the httpd.conf) and add this lines: ' Options FollowSymLinks AllowOverride All # Order deny, allow # Deny from all – user2209678 Mar 26 '13 at 13:34

1 Answers1

0

I resolved It. in the file /etc/apache2/sites-enabled/000-default the directory was pointing to /var/www and my cakephp directory was in /var/www/html/myapp/cakephp. I changed it and now its working! :)

  • If you web directory is in /var/www/html/myapp/cakephp then /var/www in the 000-default file would be valid if you were accessing the site at http://localhost/html/myapp/cakephp but if you wanted to access it as just http://localhost/ then you'd need to change it as you mentioned. – Joseph Mar 27 '13 at 02:53