Skip to content

Latest commit

 

History

History
executable file
·
47 lines (34 loc) · 1.4 KB

5.2htaccess.md

File metadata and controls

executable file
·
47 lines (34 loc) · 1.4 KB

Criação do app-mvc/public/.htaccess

Agora crie a pasta /var/www/html/app-mvc/public

E dentro dela crie o arquivo .htaccess

Contendo as linhas abaixo

app-mvc/public/.htaccess

Este redireciona toda requisição que chega ao app-mvc/public para o app-mvc/public/index.php

COMEÇO

Necessary to prevent problems when using a controller named "index" and having a root index.php

Options -MultiViews

Activates URL rewriting (like myproject.com/controller/action/1/2/3)

RewriteEngine On

Prevent people from looking directly into folders

Options -Indexes

If the following conditions are true, then rewrite the URL:

If the requested filename is not a directory,

RewriteCond %{REQUEST_FILENAME} !-d

and if the requested filename is not a regular file that exists,

RewriteCond %{REQUEST_FILENAME} !-f

and if the requested filename is not a symbolic link,

RewriteCond %{REQUEST_FILENAME} !-l

then rewrite the URL in the following way:

Take the whole request filename and provide it as the value of a

"url" query parameter to index.php. Append any query string from

the original URL as further query parameters (QSA), and stop

processing this .htaccess file (L).

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] #FINAL

Agora já podemos chamar pelo navegador assim:

http://localhost/app-mvc

Ainda reclama do Router.php

Vamos a ele.