when i am redirecting my url to sub url through alias to another record in this hosted zone .while accessing it should redirected to sub url but it is giving response from same url with 200status code

0

when i am redirecting my url to sub url through alias to another record in this hosted zone .while accessing it should redirected to sub url. while curl this url i am getting 200 status code for both url. and also when i am trying to dig both url target ip is same.

when i am access both url i am getting 200 ok

curl -I "here i have given my main url" HTTP/1.1 200 OK Date: Fri, 08 Dec 2023 09:53:51 GMT Server: Apache/2.4.41 (Ubuntu) Last-Modified: Wed, 06 Dec 2023 12:39:49 GMT ETag: "e0c-60bd6a59dd7f6" Accept-Ranges: bytes Content-Length: 3596 Vary: Accept-Encoding Content-Type: text/html

and this is my sub url curl -I "sub url" HTTP/1.1 200 OK Date: Fri, 08 Dec 2023 09:54:01 GMT Server: Apache/2.4.41 (Ubuntu) Last-Modified: Wed, 06 Dec 2023 12:39:49 GMT ETag: "e0c-60bd6a59dd7f6" Accept-Ranges: bytes Content-Length: 3596 Vary: Accept-Encoding Content-Type: text/html

kishor
已提問 5 個月前檢視次數 169 次
2 個答案
0

Hello.

How do you set up redirects?

profile picture
專家
已回答 5 個月前
  • I don't think the HTTP status code will be 300 because it's not an HTTP redirect. The settings you made are mapping between domains, so I don't think it's an HTTP redirect.

  • For example, if you are using Apache as your web server, you can configure the domain to be redirected by configuring it as follows. In the example below, if the domain "www.test.com" is accessed, it will be redirected to the domain "test.com".

    <VirtualHost *:80>
      ServerName test.com
      DocumentRoot /var/www/html
    </VirtualHost>
    <VirtualHost *:80>
      ServerName www.test.com
      DocumentRoot /var/www/www/html
      RewriteEngine on
      RewriteCond %{HTTP_HOST} ^www\.test\.com$
      RewriteRule ^/(.*) http://test.com/$1 [R=301,L]
    </VirtualHost>
    
  • If you are using ALB, you can also set up redirection by following the steps in the document below. https://repost.aws/knowledge-center/elb-redirect-to-another-domain-with-alb

0

using route53 ist hosted zone ----> record---- > create record set --> their i am giving sub url and then enable alias --------> after alias to another record in this hosted zone ----> then providing the record ----> then save it

by doing this when i will access main record it should redirect to sub record and i should see 300 status code . but i am getting response from same main record not from sub record and my status code is 200

kishor
已回答 5 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南