RewriteCond %{THE_REQUEST} /(.*)index.php.*$
RewriteRule .* /%1 [R=301,L]
RewriteCond %{REQUEST_URI} ^(.*/[^/\.]+)$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [R=301,L]
RewriteCond %{QUERY_STRING} ^oid=(.*)
RewriteRule ^(.*)$ /$1? [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_URI} /[^/.]+$
RewriteRule ^(.*)$ https://localhost/$1/ [R=301,L]
RewriteCond %{THE_REQUEST} /index\.php [OR]
RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*?)(index\.php|$) https://localhost/$1 [R=301,L]