Can redirect a page to a page with alias name?

gayatrik8153299

25-08-2020

Hi All,

We have a page where we have configured the alias name but page is not redirecting with alias name.

We are using AEM 6.4.5 version

Ex: page1 has configured alias name as page1-alias

when we hit the page with /page1.html it should redirect to /page1-alias.html but its not working.

We tried clearing the dispatcher cache and provided the root level access to anonymous user as well but still not working.

But when we direct hit the alias page is working(/page1-alias.html)

Could you please let us know whether can redirect a page to a page with alias name.

 

Accepted Solutions (1)

Accepted Solutions (1)

Andrei_Dantsou

25-08-2020

Hello @gayatrik8153299 ,

If your goal is redirection from /page1.html to /page1-alias.html, then you should use the Rewrite Rule directive:

RewriteRule /page1.html /page1-alias.html [R=301,L] - for 301 redirect (the path shown in browser will be /page1-alias.html) or

RewriteRule /page1.html /page1-alias.html [PT] (the path shown in browser will be /page1.html)

https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewriterule
https://httpd.apache.org/docs/2.4/rewrite/flags.html

The alias in the "Page Properties > Advanced" makes the page accessible via the different name. For instance if the alias for the page /content/we-retail/language-masters/en/experience/skitouring.html is set to "skitouring-alias", then the page will accessible via the /content/we-retail/language-masters/en/experience/skitouring-alias.html url as well, so the behavior you've described appears to be expected.

Regards

Answers (4)

Answers (4)

Jörg_Hoh

Employee

25-08-2020

Hi,

So you want that if you specify page1.html as target page, the alias value is used instead of the page name (if the alias is configured)? IIRC that's not default, but it should be doable using a custom rewriter.