[support] http > https redirect

Shyamala shyamala at netlinkindia.com
Sun Sep 16 23:04:42 UTC 2007


Refer:
http://drupal.org/node/16084
http://drupal.org/node/38960
http://www.askapache.com/htaccess/apache-htaccess.html

"How to create 301 redirects in Drupal Apache mod_rewrite
Edit your .htaccess file in a text editor. [Note: Be sure to save the file 
in "UTF-8" format.]

In the file, you will find the commands:


# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal

RewriteBase /
Immediately after that code -- and before the Drupal-provided "Rewrite 
old-style URLs" commands -- add your rewrite rules using the following 
format:


#custom redirects

RewriteRule ^old/URL/path$ http://yourdomain.com/new/path [R=301,L]

#end custom redirects
Note the convention: The old path is simply the path off the root. The new 
path is the full path, including the domain. The [R=301,L] code is the 301 
redirect instruction. (axbom notes: "The 301 tells browsers and spiders it 
is a permanent redirect, and the L ensures that no other rewrites are 
processed on the URL before it reaches Drupal; Hence place this code above 
Drupal 's own URL rewrite, but below the command RewriteEngine on.")  "



----- Original Message ----- 
From: "sander-martijn" <sander at sander-martijn.com>
To: <support at drupal.org>
Sent: Monday, September 17, 2007 3:44 AM
Subject: [support] http > https redirect


> Anyone know what I need to do to get individual pages to redirect to
> https?
>
> These 2 lines work:
> RewriteCond %{SERVER_PORT} !^443$
> RewriteRule ^(contact/requestBook)$ https://s24863.gridserver.com/$1
> [R=301,L]
>
> These lines, which should be the exact opposite, redirect all pages to 
> http:
> # Redirect non-secure pages to HTTP if requested by HTTPS
>  RewriteCond %{SERVER_PORT} ^443$
>  RewriteCond %{REQUEST_URI} !^contact/requestBook$
>  RewriteRule ^(.*)$ http://s24863.gridserver.com/$1 [R=301,L]
>
> I've tried all options here including node/387, index.php?q=node/387,
> including/excluding parens etc - none have worked.
>
> Obviously as is the contact/requestBook page ends in an endless loop.
>
> I tried the securepages module but it's broken.
>
> .sander
> -- 
> [ Drupal support list | http://lists.drupal.org/ ] 



More information about the support mailing list