Set RewriteBase to the current folder path dynamically

Here is one way one can grab the RewriteBase in an environment variable which you can then use in your other rewrite rules: RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$ RewriteRule ^(.*)$ – [E=BASE:%1] Then you can use %{ENV:BASE} in your rules to denote RewriteBase, i.e.: #redirect in-existent files/calls to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . %{ENV:BASE}/index.php [L] Explanation: … Read more

The Redirection of Multiple Parked Domains doesn’t Work with Filename [closed]

If the questioner starts rewrite ruling with [R=301] 301 redirect, a.k.a. “Permanently Redirect”, and then he try to view his URL www.parkeddomain1.com/subfolder/ but the result of the rule wasn’t what he want, then even he try to change the redirecting rule, his web browser will always redirect that URL into the first URL where it … Read more

Exclude a folder/directory from RewriteRule

You may try replacing the complete WP rule-set with this one: # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ – [L] # Include in the next line all folders to exclude RewriteCond %{REQUEST_URI} !(folder1|folder2|folder3) [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress

.htaccess Redirect non-WWW to WWW preserving URI string

I had a similar problem, and this .htaccess works for me RewriteEngine On #This bit rewrites your host name to include www RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,NC,L] #This bit does the codeigniter magic RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L]

Apache mod_rewrite REDIRECT_STATUS condition causing directory listing

You have this condition to stop looping: ## Internal Redirect Loop Protection RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule ^ – [L] This works by checking internal Apache variable %{ENV:REDIRECT_STATUS}. This variable is empty at the start of rewrite module but is set to 200 when first successful internal rewrite happens. This above condition says bail out of … Read more