What does this Rewrite rule mean?

Im installing phpancake, there is a folder there shema like this

application/ install/ library/ public/ sql_schema/ install.html install.php 

What does this rule mean?

 RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ /vote/public/index.php [NC,L] 
+7
.htaccess rewrite rule
source share
3 answers

Rewriting consists of two parts. The first indicates that if the requested file name is a regular file with a size larger than 0 ( -s ), a symbolic link ( -l ) or directory ( -d ) are copied to nowhere, for example. do not take any action. [NC,L] means that the rule is not case sensitive, and the last rule meets these conditions.

All other requests are redirected to /vote/public/index.php .

The purpose of this overwrite is that an actual, existing file can be retrieved from the server without interference. Without the first rule, each file request (css and js files, images, etc.) would go to index.php , which would ruin the situation quite badly.

This is usually written in one ad. You can cancel the conditions, and then you can also render statemens [OR] :

 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-s RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^.*$ /vote/public/index.php [NC,L] 

This is equivalent to the original statement.

+11
source share

Basically, these are standard rewriting files that check if the requested file (or directory or symbolic link) exists on the disk, in this case the file / directory / etc. should be used.

All other matches should go to / votes / public / index.php

0
source share

The first rule will go through all requests that can be mapped to a regular file larger than zero ( -s ), symbolic link ( -l ) or directory ( -d ). Each other request is retrieved by the second rule and overwritten in / vote / public / index.php.

0
source share

All Articles