I have a custom build non-CMS site on PHP.
The way my current .htaccess is setup is to allow me to use the urls without ".php" part and to 301 redirect all non www requests to www:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]
Now we are switching to HTTPS.
How do I get a proper SEO-friendly redirect from http://
to https://
in .htaccess?
I've tried replacing third string with
RewriteRule (.*) https://www.example.com/$1 [R=301,L]
but it doesn't do the trick...
Also, optionally, is there a way to set up a 301 redirect for .php request to redirect to non-.php variant? Although it looks like it means to redirect to same exact page, not sure if it will be SEO-safe to do it or maybe it will even result in a redirect loop?