0

I have two domains on my wordpress site: example.net and example.com and want to redirect all users to https://example.com (with ssl and with out www).

Link examples:

http://example.com 
http://www.example.com
http://example.net
http://www.example.net
https://example.com
https://www.example.com
https://example.net
https://www.example.net

Expression I use now:

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

I tried to use some other standard expressions and they work somehow but this and all other solutions have the same problem. They don't redirect links to https://example.com/category/ or https://example.com/category/sub-category/
Another links as www.example.net/category/some.html are redirected to example.com/category/some.html as they should. Can't understand where is the problem.

San4itos
  • 36
  • 2
  • "They don't redirect links to `https://example.com/category/` or" - But why would you want to redirect this request? Where to? This would already seem to be the canonical URL (ie. HTTPS + `example.com`)? "Another links as www.example.net/category/some.html` are redirected to `example.com/category/some.html`" - What redirects that? The rule you posted obviously does not do that. – MrWhite May 24 '22 at 14:33
  • Sounds like a situation where using rewrite logging would make sense for the OP to understand what happens inside his own systems. – arkascha May 24 '22 at 15:22

0 Answers0