Forum Moderators: phranque
[edited by: not2easy at 6:21 pm (utc) on Jan 28, 2022]
[edit reason] ummm, please use example.com [/edit]
RewriteCond %{HTTP_HOST} !^example\.new$
RewriteRule (.*) http://example.new/$1 [R=301,L]
RewriteCond %{HTTPS} !on [OR]
[edited by: not2easy at 8:19 pm (utc) on Jan 28, 2022]
[edit reason] Please see TOS [webmasterworld.com] [/edit]
Don't you mean at the very start?No, because this is essentially a canonicalization redirect. As such it should come after any rules that apply to specific URLs--and, of course, after any access-control rules made with mod_rewrite.
However, if one tries to access it using https, it won't redirect them at all.Uh-oh. Better explain some more about how your site handles HTTPS. Sometimes there's a third-party involvement and then all the rules change.
However, if one tries to access it using https, it won't redirect them at all.
It only works if they use http, i.e.: http://example.com.br/
...I should have said: after all external redirects. Internal rewrites ([L] flag alone), including anything done by a CMS, come after those.
My website's URL is: https://example.com.
However, if one tries to access it using https, it won't redirect them at all.
It only works if they use http, i.e.: http://example.com.br/, then it will redirect them to https://example.com/