Forum Moderators: phranque
RewriteCond %{REQUEST_URI} !(specific-folder) [NC]
RewriteCond %{QUERY_STRING} .
RewriteRule ^$ /? [R=301,L] RewriteCond %{REQUEST_URI} !(specific-folder|page) [NC]
RewriteCond %{QUERY_STRING} .
RewriteRule ^$ /? [R=301,L] RewriteCond %{REQUEST_URI} !(specific-folder|page) [NC]
RewriteCond %{QUERY_STRING} .
RewriteRule ^$ /? [R=301,L]
RewriteCond %{QUERY_STRING} .
RewriteCond %{REQUEST_URI} !^/specific-folder [OR]
RewriteCond %{REQUEST_URI} !^/preview$ [OR]
RewriteCond %{REQUEST_URI} !^/e$
RewriteRule ^ %{REQUEST_URI} [QSD,R=301,L]
RewriteCond %{QUERY_STRING} .
RewriteCond %{REQUEST_URI} !^/specific-folder
RewriteCond %{REQUEST_URI} !^/preview$
RewriteCond %{REQUEST_URI} !^/e$
RewriteRule ^ %{REQUEST_URI} [QSD,R=301,L]
RewriteCond %{QUERY_STRING} .
RewriteCond %{REQUEST_URI} !^/specific-folder
RewriteCond %{REQUEST_URI} !^/preview
RewriteCond %{REQUEST_URI} !^/e
RewriteRule ^ %{REQUEST_URI} [QSD,R=301,L] I think because that signifies the end of the match, doesn't it? And it needs the query string added on?If your URLs end in / slash, then forms ending in blahblah$ will never match. A query string is not considered part of REQUEST_URI (though it would be part of THE_REQUEST) so you need not worry about that aspect.
Oops, sorry, silly logic error... those conditions should all be AND'd, not OR'd!
Remove the "OR" flag..
The URLs 'e' and 'preview' don't end in slash because they are pages, not folders.Huh. If they're extensionless, then a final $ certainly should work. If you use extensions, then obviously you should include the extension in the pattern--or at least
Any of those conditions applies in its own right so why do they need each other?Because they're negative conditions: the request is not abc AND ALSO not def AND ALSO not ghi. If you goofed and said [OR], then the conditions would always be met: a request for abc is not def, a request for def is not ghi and so on.
It works that way but I don't understand why. Any of those conditions applies in its own right so why do they need each other?
set A=1
IF (A != 1) OR (A != 2) OR (A !=3) THEN
// Always successful
The URLs 'e' and 'preview' don't end in slash because they are pages, not folders.
If you goofed and said [OR]
Maybe there is a bit of a conflict?
Should I put those below it with the query string rules at the top?
RewriteRule ^ https://www.example.com%{REQUEST_URI} [QSD,R=301,L]
Edit: I put the query string rules at the top but the dollar symbol still has to be removed for it to work.
Options -MultiViews RewriteCond %{QUERY_STRING} .
RewriteCond %{REQUEST_URI} !^/folder/(admin|preview|e)
RewriteRule ^ https://example.com%{REQUEST_URI} [QSD,R=301,L]