Doubt in .htacess

0

Well, I'm doing internships in a web development company and tals and soon we had a problem in redirecting the page.

In the company we used for this project Php MVC (I never got to deepen in Php) and an .htacess file that I had never seen before.

Then about this file, can you explain what this code is doing?

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} (\.php)$

#RewriteBase /projetos/c/*****/dev/acompanhamentoobra/
RewriteBase /acompanhamentoobra/

RewriteRule ^(.+)$ index.php?path=$1 [QSA,L]
    
asked by anonymous 29.11.2016 / 14:26

1 answer

1

Briefly, the URL rewrite rule says that all requests must go to the index.php file to receive the requests by the path parameter.

In this file index.php will have something like $_GET['path'] or it may be inside a function and not visible in indesx.php.

These rules will be applied to the /acompanhamentoobra/ folder that is set to base.

The lines with -f , -d and -l are to ignore the rule if an existing file, directory, or symbolic link is accessed respectively.

The (\.php)$ snippet is to bypass .php files in this folder and enter the rewrite condition.

obs:
But do not confuse or mix things up. PHP, MVC and htccess are distinct from each other. In the question itself there is nothing MVC or PHP.

htaccess is part of the mod_rewrite module for Apache.

    
29.11.2016 / 14:40