Reputation: 103
I have a functional URL shortening site. Recently I added SSL to the website and configured the .htaccess
for proper redirecting. The issue is that all of the http://
requests, redirect back to the homepage https://websi.te
Currently, I've tried setting up redirecting as follows:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
An example of what's going wrong:
User types http://websi.te/keyword
or websi.te/keyword
and they are redirected to https://websi.te
instead of https://websi.te/keyword
Upvotes: 0
Views: 447
Reputation:
Change your rewrite to this:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]
$1 is first group match ^(.*)$, it's your request.
Upvotes: 0