mAfiA
mAfiA

Reputation: 1

How to run cakephp code as a localhost? Instead of http://localhost/cakephp

I'm able to run my code as http://localhost/CakePHP but I need to run this as http://localhost.

For this, I moved my all files of CakePHP project (/var/www/html/CakePHP) to /html directory and remove empty "CakePHP" directory. Now my whole code placed in html directory.

but getting the following message:

URL rewriting is not properly configured on your server.

I have enabled the rewrite module. Please check my .htaccess file directive, Am I do anything wrong?

1st File: cat /var/www/html/.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

2nd File: cat /var/www/html/webroot/.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
   # RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Upvotes: 0

Views: 270

Answers (1)

Mr.Geeker
Mr.Geeker

Reputation: 445

Your htaccess in your root directory should look like the following

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

Upvotes: 0

Related Questions