将某些页面重定向到https,将其他所有页面重定向到http

时间:2014-07-24 10:22:56

标签: php .htaccess joomla3.0

我找到了如何使用htaccess将某些页面重定向到https和其他所有页面到http的解决方案请查看下面的答案以获取更多详细信息

1 个答案:

答案 0 :(得分:0)

Please use bellow .htaccess rules to redirect some pages to https and other pages to http,


RewriteEngine On

# Force SSL on my-listing and add listing pages
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (my-listing|new|choose-listing-type-plans)
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Remove SSL on other pages
RewriteCond %{HTTPS} on 
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif|css|js|woff|ttf|ico|php|txt|svg) [NC]
RewriteCond %{REQUEST_URI} !(my-listing|new|choose-listing-type-plans) 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]



Thanks,
<h1>Nilesh G. Pangul</h1>
@http://www.facebook.com/nileshgpangul