htaccess/mod_rewrite: http to https (particular dir)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • piku
    Senior Member
    • Mar 2004
    • 153

    #1

    htaccess/mod_rewrite: http to https (particular dir)

    for .htaccess/mod_rewrite gurus or pros ^^

    i've got the following
    Code:
    RewriteEngine on
    # SERVER_PORT <> Port:443
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^(.*) https://%{HTTP_HOST}/dir/$1 [R=301,L]
    it is currently sitting at "/dir/.htaccess" .... i got two things that i would like to do...

    1) how do i port this out to sit on the root "/" directory? (but make the rule only apply for a certain "/dir")

    2) the current rule doesn't work if i enter "http://www.domain.com/dir" (w/o the trailing slash) ...instead of "http://www.domain.com/dir/" (which works). any fix?

    TIA.

    ps. or will it be easier to have another .htaccess file in the dir i want to redirect http to https traffic to? if so, any pointers would help as well.
    my signature was deleted. i miss my signature-filled-with-helpful-dathorn-links *sniff*sniff*
Working...