RewriteRule (mod_rewrite)

What does this rewrite rule mean?

   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]

Sorry, even after reading the explanation of the mod_rewrite syntax, I did not get it ...: // Can someone explain to me what this rule does.

Many thanks.

+3
source share
2 answers

I will try to give a brief explanation that I hope will clear this for you.

First: If you have never used regular expressions, go to the search.

A RewriteRule - three different parts. Firstly, it is an expression used to search for a query string for a specific template. The second destination line, which is actually served from the server. Thirdly, these are options that are included in parentheses.

, , . , , .

, ( http://www.example.com/), :

http://www.example.com, ( - , .htaccess).

http://www.example.com/page2.html, app/webroot/page2.html. , 404.

RewriteRules [L] . , Apache, . , Apache , . , , .

+6

^$ / app/webroot/. [L] , "" , , mod_rewrite , .

(.*) app/webroot/ "". , [L] .

http://www.yoursite.com/, http://www.yoursite.com/app/webroot/ ( - , index.php, .

, http;//www.yoursite.com **/path/to/some/page.php **. "", mod_rewrite http://www.yoursite.com/app/webroot /path/to/some/page.php.

http://www.yoursite.com/.

, , , . http://www.yoursite.com/app/webroot/index.php, mod_rewrite http://www.yoursite.com/app/webroot/app/webroot/index.php, , , , .

+1

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


All Articles