2

I have a client folder located at http://www.example.com/client However, I've now installed SSL on the server, and want to add a permanent redirect using HTACCESS so that whenever /client is accessed, that it redirects to: https://www.example.com/client

Anybody know how to do that?

I've redirected my domains in the past like this:

RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

This should not affect the solution, but the site must still redirect to www.example.com FIRST, and then to https://www.example.com/client if for example, http://www.example.co.za/client is entered.

Gumbo
  • 643,351
  • 109
  • 780
  • 844
rockstardev
  • 13,479
  • 39
  • 164
  • 296
  • Possible duplicate: http://stackoverflow.com/questions/1213404/using-htaccess-to-control-https-on-certain-pages/1214288#1214288 – Gumbo Aug 01 '09 at 07:58

2 Answers2

1

Try this:

RewriteCond %{HTTPS} !on
RewriteRule ^client(/.*)?$ https://www.example.com%{REQUEST_URI} [L,R=301]
Gumbo
  • 643,351
  • 109
  • 780
  • 844
1

RewriteEngine On RewriteRule ^/?$ https://www.example.com/client [301,NC,L]

It tells the apache, whenever the url is https://www.example.com or either with slash at the end, will redirect to ur /client