0

I was not sure of the best way to describe this in the title but my scenario is the following:

Every page on our site requires authentication and will redirect unauthenticated users to a login page from pretty much any other url.

We do not want the login page link to show up as a search result in google since the base url (site.com/login) is not valid. We are using openid-connect for authentication and the login page url will always have a query string containing additional data for openid such as the redirect uri and a session specific state. Therefor, we dont want various variations of login urls showing up in google search results which will not be valid when clicked.

Ideally, we would be able to have only the root url appear in the search results (www.site.com). Clicking on this link will properly route the user to the login page which contains the proper query string.

We currently have this configured so that it almost works how we want. We have added the login page base url and a few other "public but invalid without context" url to our robots.txt and currently a google search does turn up only the root url of the site.

Functionally this is great, however, there is no description beneath the link other than "No information is available for this page." This I believe is due to google following the redirect and finding that the destination is excluded via robots.txt.

The login page does contain the meta description we want to show up under the search result. My question is, can I somehow instruct google to use that description for the root url without having the login page show up as a search result?

I have read about the use of a <link> with rel="canonical" but it seems that using a url which always returns a 302 as the canonical link can cause issues.

I feel like there must be other sites using a similar login model which handle this properly but I have little experience working with search engines like this and have had no luck finding information about this scenario.

1 Answer 1

1

You need to make up your mind, you either index it, or you don't.

Whatever met data you want on your root url, you have to put it on there. Dont index your login page. Then you dont have an issue with duplicated content.

Canonical is to tell Google that two pages are the same such as one with a www and one without. You can't misuse it.

2
  • The root url is not publicly accessable. Attempting to navigate to the root url as an anonymous user will redirect to the login page
    – Mason
    Jul 16, 2023 at 18:25
  • It seems this ('anonymous user will redirect to the login page') is a strange decision and will not give you the desired result of indexing. Maybe, the one and the only root URL page should be accessible in OK status without any errors and redirection ( IMHO )
    – Tom Newton
    Jul 17, 2023 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.