skip to Main Content

How to redirect non www and http to https with www via htaccess?
I want to redirect old folder to home page like http://.test.com/test1/about.php to https://www.test.com

2

Answers


  1. Put these line in your .htaccess file in root directory of your webserver:

    Redirect 301 /test1/about.php to https://www.test.com
    

    Also make sure that you haven’t disable .htaccess in your apache config.

    Login or Signup to reply.
  2. Try this conf one on your server configuration :

     RewriteEngine On
     RewriteCond %{HTTP_HOST} !^www. [NC]
     RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
     RewriteCond %{SERVER_PORT} !^443$
     RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [L,R=301]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search