.htaccess https redirect best method

Posted by Douglas Cottrell on Server Fault See other posts from Server Fault or by Douglas Cottrell
Published on 2012-04-11T21:52:36Z Indexed on 2012/04/11 23:33 UTC
Read the original article Hit count: 329

Filed under:
|

I have searched through all the redirects posted buy others and cant quite find the answer to my problem.

I have a website with over 3000 pages and we are getting duplication issues within google.

We want to keep everything in the parent directory to be http except our contact.php and login.php page.

We then have 3 folders that must be secured. admin, clients, customers

I have tried using the following code in seperate .htaccess files for each folder, but I keep getting a conflict when I try and I am still trying to find a good solution for the home directory.

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} admin
RewriteRule ^(.*)$ https://www.website.com/$1 [R,L]

Any help would be greatly appreciated.

© Server Fault or respective owner

Related posts about .htaccess

Related posts about mod-rewrite