Avatar of A A
A A

asked on 

reditection of siteof https:domainname.com to https:// www. domainname2.com although conf file has http only

Dear experts
I have site as www.domain.name.com that work fine at http://www.domainname.com and not working when entering https://www.domainname2.com when trying to use https as redirect to another site I have fetched config file in apache as found only http and nothing for redirect or even https header.waiting for your kind advice regarding to stopping https redirection to another site
Linux* redirectApache Web ServerWeb Servers

Avatar of undefined
Last Comment
David Favor
Avatar of David Favor
David Favor
Flag of United States of America image

Use real domain names for debugging assistance.

Better to test + known, than guess.

Or you can test this yourself using the command...

curl -I -L URL

Open in new window


To emit the entire redirect chain, as each redirect occurs.
Avatar of arnold
arnold
Flag of United States of America image

you are providing example without the matching configurations that you are using.

As David noted, detail is how the issue can be determined.
You could enable loging on the redirects and it will tell you why yours is not working as you expect i.e. when www.somedomain2.com is requested, it falls through because it does not match the conditions you have setup.


depending on your setup, usually http handlers are in one file httpd.conf or if using cpanel, or similar, the data is one location while the encrypted https data is in a separate file such as ssl.conf that gets imported into httpd.conf or it could be further in conf.d/domain2.conf that has both the http and https definition and a typo is the cause of your issue. it is not matched.
Avatar of A A
A A

ASKER

could you please to clarify and give me more details
Avatar of arnold
arnold
Flag of United States of America image

This is the information David and I are asking for.

We need to see what your configuration is.
you can mask the config data to match your example of www.domain.name.com www.domainname.com and www.domainname2.com

In the configuration ServerName as well as in the redirect rules that match the entries.

this way we might be able to answer your situation.

If you are looking at the troubleshooting/logging redirect, which version of apache are you using?
Look at the logging example
https://httpd.apache.org/docs/current/mod/mod_rewrite.html
Avatar of A A
A A

ASKER

Hi arnolad
what will be exact syntax for  redirection  from site to another  and how to check redirection sites  enabled without testing in web browser
Avatar of arnold
arnold
Flag of United States of America image

you first have to make sure mod_rewrite is enabled. and it depends whether this is a permanent or temporary.

The link deals with the various.

within the VirtualHost definition
RewriteCondition if you want to validate what the request or source of request is before you redirect
RewriteRule /.  https://newdomain.com

Another way if you want your www.domainname.com to also handle www.domainname2.com you can add ServerAlias www.domainname2.com to the config.

I have no idea what you are trying to achieve so the answer is all over the place trying to cover as many possibilities as I can think of at the moment.
Avatar of A A
A A

ASKER

Hi David I closed
I have issue in AWs load balancer as I need to direct www.domain.com to load balancer as it works through http://domain.com and https://domain.com but not www.domain .com all the direction is made to loadbalancer but I dont know exacrtly how I can let it work as sell in www.domain.com 
Avatar of arnold
arnold
Flag of United States of America image

look where www.domain.com points to and where domain.com points to.
check the logs to see whether you get an errror from the webserver or you have an issue on the loadbalancer not properly forwarding these requests.
Can you confirm whether www.domain.com is an alias to domain.com?
If it is, i do not think the load-balancer is the issue.
now check the definiotion of your web site and make sure the domain.com is also has www.domain.com as an alias within the web handling scope. and see if that fixes your issue/situation.
Avatar of A A
A A

ASKER

HI arnold and david 

There is no alias created for loadbalancer only cname  www.domain.com to value of  dns name of loadbalancer
waiting for your kind advice from you or david 
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of A A
A A

ASKER

when try to do nslookup for website without www and with www I obtain ips of loadbalancer but differnt ips
kindly i would like to do redirection from non www to www through route 53 to loadbalancer (classic)
Avatar of David Favor
David Favor
Flag of United States of America image

What you're describing indicates either a DNS or HTTPS problem.

Better to test + know, than guess.

Provide your actual domain name for testing.
Avatar of A A
A A

ASKER

Hi david I  verified the issue and  got that those are ips of load balancers in aws and  I saws that it is assigned to their ips of loadbalancer in aws as  there are in availability zone so the issue is not with dns and  with redirection in route 53  how do I redirect www to non www known that domain is hosted in route 53 
Avatar of David Favor
David Favor
Flag of United States of America image

All "redirects" occur using HTTPS config directives, link provided above.

Then you'll test your redirection config using curl, per curl command provided above.
Avatar of A A
A A

ASKER

H david
do you mean that I edit apache file instead configure load balancer or dns 53 as I think that it could be done by route 53
$ORIGIN domain.com ;; Load Balancer Addresses @ IN A 3.3.3.3 @ IN A 4.4.4.4 ;; handle www www IN CNAME @

if yes by editing apache , is there specific location I have to add those lines??
Avatar of arnold
arnold
Flag of United States of America image

Aws, are you not using a cpanel or an equivalent tool to manage domain entries?
Avatar of A A
A A

ASKER

No I am hosting domain in route 53 in aws 
SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of A A
A A

ASKER

HI David
what are command that let me add load balancer in apache and check current redirect that is working 
Avatar of A A
A A

ASKER

Hi arnold
 where you can add an alias, www.domainname.com www.domainname2.com etc. t

how can I do that in aws loadbalancer or apache  or route 53 
Avatar of arnold
arnold
Flag of United States of America image

Please refer to
https://docs.aws.amazon.com/amplify/latest/userguide/to-add-a-custom-domain-managed-by-amazon-route-53.html

Confirm that your setup uses both domainname.com and www.domainname.com 

in the left pane they cover the various option.

this might be more detailed to what you are after
https://docs.aws.amazon.com/amplify/latest/userguide/to-manage-subdomains.html
SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Linux
Linux

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.

71K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo