What is RewriteBase. RewriteBase directive allows you to easily set the beginning of all relative paths used in . htaccess file. Its value is used in the target/destination path mentioned in rewrite rules in . htaccess file.
The $1 is basically the captured contents of everything from the start and the end of the string. In other words, $1 = (. *) .
Try this rule before your other rules:
RewriteRule ^(admin|user)($|/) - [L]
This will end the rewriting process.
What you could also do is put a .htaccess file containing
RewriteEngine Off
In the folders you want to exclude from being rewritten (by the rules in a .htaccess file that's higher up in the tree). Simple but effective.
add a condition to check for the admin directory, something like:
RewriteCond %{REQUEST_URI} !^/?(admin|user)/
RewriteRule ^([^/] )/([^/] )\.html$ index.php?lang=$1&mod=$2 [L]
RewriteCond %{REQUEST_URI} !^/?(admin|user)/
RewriteRule ^([^/] )/$ index.php?lang=$1&mod=home [L]
If you want to remove a particular directory from the rule (meaning, you want to remove the directory foo) ,you can use :
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/foo/$
RewriteRule !index\.php$ /index.php [L]
The rewriteRule above will rewrite all requestes to /index.php excluding requests for /foo/ .
To exclude all existent directries, you will need to use the following condition above your rule :
RewriteCond %{REQUEST_FILENAME} !-d
the following rule
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !index\.php$ /index.php [L]
rewrites everything (except directries) to /index.php .
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