1. Redirect all files in a directory
Add these contents into the ".htaccess" file under your directory.
##################
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
##################
Then:
"http://domain/dir/a.php" will redirect into "https://domain/dir/a.php",
"http://domain/dir/b.php" will redirect into "https://domain/dir/b.php",
"http://domain/dir/c.php" will redirect into "https://domain/dir/c.php".
2. Redirect a single file in a directory
Add these contents into the ".htaccess" file under the directory containing your file.
##################
<FilesMatch "^login\.php$">
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</FilesMatch>
##################
Then:
"http://domain/dir/login.php" will redirect into "https://domain/dir/login.php"
"http://domain/dir/other_files.php" will not redirect.
--
from my gmail
20100912
订阅:
博文评论 (Atom)
没有评论:
发表评论