admin rewrite to ssl Topic is solved

General project discussion. NOT for help questions.
Post Reply
unix_poser

admin rewrite to ssl

Post by unix_poser »

Hi,

I have done a rewrite that would automatically redirect when the user type http://localhost/cms/admin to https://localhost/cms/admin, but some parts inside admin are not working.

Anyother will be redirected to http.


VirtualHost

RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_HOST}    (.*) [NC]
RewriteRule ^/admin/(.*)$  https://%{SERVER_NAME}/admin/$1 [L,R]


VirtualHost

RewriteEngine On
RewriteOptions inherit
RewriteCond %{REQUEST_URI}    !^/admin(.*) [NC]
RewriteRule (.*)      http://%{SERVER_NAME}$1 [R]


Kindly help.

Thanks
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: admin rewrite to ssl

Post by blast2007 »

You can simply add an .htaccess inside admin directory (as seen here)

Code: Select all

# force all access to /admin to SSL protected page
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
This works fine in all admin area.

Note:
You if are using module SiteMapMadeSimple you should edit your default template:
in extension->sitemap made simple>templates>sample (thanks to Robert Gruber)

change:

Code: Select all

   {$page->url}
into:

Code: Select all

   {$page->url|replace:"https":"http"}

Regards
blast
Post Reply

Return to “General Discussion”