Carter Roeser
Carter Roeser

Reputation: 360

.htaccess redirect request to subdomain subfolder with ssl

I would like to redirect all requests from http://sub.domain.com to https://sub.domain.com/en/.

For example, a customer visiting http://sub.domain.com/test will be redirected to https://sub.domain.com/en/test/ through htaccess rule.

What rule is needed to accomplish this?

Upvotes: 0

Views: 71

Answers (1)

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

Try it like this,

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ https://sub.domain.com/en/$1 [R=301,L]

Upvotes: 1

Related Questions