Home exclude a sub directory from .htaccess 301 redirects
Reply: 1

exclude a sub directory from .htaccess 301 redirects

rslash
1#
rslash Published in 2017-11-14 01:56:43Z

Can you tell me how I can exclude a specific folder from the 301 redirects set up as below in htaccess

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
</IfModule>
Florian Lemaitre
2#
Florian Lemaitre Reply to 2017-11-14 13:24:57Z

This should work:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^(/excluded_directory)
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
</IfModule>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.3386 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO