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

htaccess RewriteRule page with query string

You need to match against the %{QUERY_STRING} variable. The query string isn’t part of the match in a RewriteRule: RewriteCond %{QUERY_STRING} ^who=a$ RewriteRule ^people.php$ /people/?t=leadership [R=301,L] RewriteCond %{QUERY_STRING} ^who=f$ RewriteRule ^people.php$ /people/?t=faculty [R=301,L] RewriteCond %{QUERY_STRING} ^who=p$ RewriteRule ^people.php$ /people/?t=students [R=301,L] RewriteCond %{QUERY_STRING} ^who=r$ RewriteRule ^people.php$ /people/ [R=301,L] RewriteCond %{QUERY_STRING} ^$ RewriteRule ^people.php$ /people/ [R=301,L]

RewriteCond to match query string parameters in any order

You can achieve this with multiple steps, by detecting one parameter and then forwarding to the next step and then redirecting to the final destination RewriteEngine On RewriteCond %{QUERY_STRING} ^category=([^&]+) [NC,OR] RewriteCond %{QUERY_STRING} &category=([^&]+) [NC] RewriteRule ^index\.php$ $0/%1 RewriteCond %{QUERY_STRING} ^subcategory=([^&]+) [NC,OR] RewriteCond %{QUERY_STRING} &subcategory=([^&]+) [NC] RewriteRule ^index\.php/[^/]+$ $0/%1 RewriteCond %{QUERY_STRING} ^product=([^&]+) [NC,OR] RewriteCond %{QUERY_STRING} … Read more

RewriteRule checking file in rewriten file path exists

RewriteRule ^pages/([^/\.]+) cache/pages/$1.html [NC,QSA] # At this point, we would have already re-written pages/4 to cache/pages/4.html RewriteCond %{REQUEST_FILENAME} !-f # If the above RewriteCond succeeded, we don’t have a cache, so rewrite to # the pages.php URI, otherwise we fall off the end and go with the # cache/pages/4.html RewriteRule ^cache/pages/([^/\.]+).html pages.php?p=$1 [NC,QSA,L] Turning off … Read more