CakePHP and .htaccess in a co-hosting environment

Hello!

I have a CakePHP based application on shared hosting. I wonder if there is a way to clear the url via .htaccess. What errors me in is that I have to have index.php in it, or I get 404:

project.com/index.php/controller/method

Initially, I was getting 404 error, no matter what, and my host administrator finished configuring RewriteEngine, and now it looks like this.

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

Is there a fix for this without .htaccess? How is it now, does it pose any security risk?

thanks

+3
source share
2 answers

You need three .htaccess files:

  • /. Htaccess
  • /app/.htaccess
  • /app/webroot/.htaccess

, , -, , - . URL- project.com/webroot/, . project.com/app/webroot/, , , index.php? Url = $1 ( project.com/app/webroot/).

; CakePHP, : http://book.cakephp.org/2.0/en/installation/url-rewriting.html ( 3- ).

+4

, mod_rewrite ?

+2

Source: https://habr.com/ru/post/1716597/


All Articles