Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forumguidelines
Alok Uniyal
1.6k
390
20.1k
Redirect multiple website in single .htacess file
Dec 29 2018 12:06 AM
I have two websites example1.com and example2.com hosting in same server.
example1.com is https secure and should redirect to https://www.example1.com
example2.com is not secure it should redirect to http://www.example2.com
Currently I am using
# ensure www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# ensure https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
But it is redirecting both URLs.
Please help how to write different RewriteRule for both URLs in single .htacess file.
Reply
Answers (
3
)
How to Validate Phone Numbers in PHP
Internationalize site php