TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
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
Forums
Monthly Leaders
Forum guidelines
Alok Uniyal
1.3k
394
22.6k
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