. The htacess file is created and the command RewriteEngine On RewriteRule ^ reg /? $ /game/reg.php [L, QSA] is written there. The QSA flag means adding an existing query string after rewriting the URI. Example:
URL = http://example.com/foo/bar?q=blah
Rule:
RewriteRule ^ foo /(.*)$ /index.php?b=$1 Result = /index.php?b=bar
Notice that q = blah is missing. Since the existing query string is discarded in favor of the one specified in the target rule, (b = $ 1). Now, if you enabled the QSA flag:
RewriteRule ^ foo /(.*)$ /index.php?b=$1 [QSA] The result becomes = /index.php?b=bar&q=blah
The L flag simply means to stop applying any rules. Given the same URL, http://example.com/foo/bar?q=blah and defined rules:
RewriteRule ^ foo -
RewriteCond% {REQUEST_URI}! ^ / Bar.php RewriteRule ^ (. *) $ / Bar.php?z=$1 The first rule applies, and the URI is passed unchanged (via the target object -). The rewrite engine then processes the next rule, and the URI is rewritten to /bar.php?z=foo/bar. What happens when you add L to the end:
RewriteRule ^ foo - [L]
RewriteCond% {REQUEST_URI}! ^ / Bar.php RewriteRule ^ (. *) $ /Bar.php?z=$1 The URL http://example.com/foo/bar is passed unchanged from the first rule, and then stops because for the L flag. If the URL is http://example.com/something/else , then the first rule does not match, and the second rule applies by rewriting the URI to: /bar.php?z=something/else
Note that since the rewrite mechanism passes all the rules until the URI stops changing, the L flag will not interfere with the loop, only any additional rules will be applied in the current iteration
Как сделать так, чтобы запрос www.site.com/home был направлен на файл index.html в папке сайта?. Requests are sent to a file through a web server, the web server decides whether to execute the file (PHP) or return its content (JPG for example). That is, the URL address and the files on the server are basically unrelated to 99% of the sites. Learn the theory of HTTP and routing through a server - without this, you cannot become a highly paid specialist ... - Goncharov Alexander