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
Asked
Active
Viewed 49 times
-1
-
Did you try to use the Search bar at the top of the website? – Koen Hollander Sep 14 '18 at 09:39
2 Answers
0
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.

Hòa Lê Việt
- 21
- 2
-
-
-
You can check document of htaccess for your purpose. If you want to force www in the url your can try htaccess rewrite. RewriteRule (.*) https://www.test.com/$1 [R=301,L] – Hòa Lê Việt Sep 14 '18 at 09:50
-
Maybe this link will help you: https://coolestguidesontheplanet.com/redirecting-a-web-folder-directory-to-another-in-htaccess/ – Hòa Lê Việt Sep 14 '18 at 09:53
0
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]

black4bird
- 617
- 1
- 5
- 13