0

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>
2
  • What path does your main Apache configuration say the DocumentRoot is? Commented Oct 30, 2018 at 20:15
  • Path is: DocumentRoot "/var/www/html" Commented Oct 31, 2018 at 4:50

1 Answer 1

0

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.