Just found this .htaccess rewrite code
RewriteEngine on RewriteCond %{HTTP_HOST} ^my.domain.com$ [NC,OR] RewriteCond %{REQUEST_URI} !public/ RewriteRule (.*) /public/$1 [L]
And I was wondering what was the purpose of the "OR" flag. Already checked the doc http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteflags but coulnd find any infos.
Any ideas?
RewriteRule "\.exe" "-" [F] This example uses the "-" syntax for the rewrite target, which means that the requested URI is not modified. There's no reason to rewrite to another URI, if you're going to forbid the request.
The <IfModule mod_rewrite. c>... </IfModule> block ensures that everything contained within that block is taken only into account if the mod_rewrite module is loaded. Otherwise you will either face a server error or all requests for URL rewriting will be ignored.
htaccess rewrite rules can be used to direct requests for one subdirectory to a different location, such as an alternative subdirectory or even the domain root. In this example, requests to http://mydomain.com/folder1/ will be automatically redirected to http://mydomain.com/folder2/.
QSA means that if there's a query string passed with the original URL, it will be appended to the rewrite ( olle? p=1 will be rewritten as index.
from http://httpd.apache.org/docs/current/mod/mod_rewrite.html
ornext|OR
(or next condition) Use this to combine rule conditions with a local OR instead of the implicit AND. Typical example:
RewriteCond %{REMOTE_HOST} ^host1 [OR] RewriteCond %{REMOTE_HOST} ^host2 [OR] RewriteCond %{REMOTE_HOST} ^host3 RewriteRule ...some special stuff for any of these hosts...
[OR] is used when you want to have, one OR another OR another condition, trigger the rewriterule. Otherwise the default behavior is 'AND' All of the RewriteConds have to be true in order to trigger the rule.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With