.htaccessrobots.txthttp-redirect

301 Redirect Full URL


How do I create a redirect so that http://fullurl/store redirects to https://fullurl/store

Do I do this in htaccess or robots?


Solution

  • robots.txt is used only for telling search engine bots and other crawlers how to deal with your URL structure, it has nothing to do with redirecting the user.

    To force HTTPS on a site, add the following to the .htaccess file in the web root of fullurl (or inside the root of store to redirect only that directory to HTTPS):

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