Expand my Community achievements bar.

SOLVED

domain redirect to plp page on aem cloud dispatcher

Avatar

Level 4

Hi Team,

I have one requirement 

if someone is hitting the domain  it should redirect to plp.html without showing the URL in the browser 

for redirection, I have added this rule 

RewriteRule ^/$ /content/whatsappsim/de/de/plp.html [PT,L]

with this, I am able to redirect  but I don't want to show  the plp.html  to the browser 

 

Ex: - 

https://www.whatsappsim.de I am redirecting to https://www.whatsappsim.de/plp.html 

I want to serve the content from plp.html,  I don't want to show /plp.html  to the browser.

how to achieve this

 arunpatidar

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You can check this

https://httpd.apache.org/docs/2.4/rewrite/remapping.html 

 

From Old to New (internal)

Description:

Assume we have recently renamed the page foo.html to bar.html and now want to provide the old URL for backward compatibility. However, we want that users of the old URL even not recognize that the pages was renamed - that is, we don't want the address to change in their browser.

Solution:

We rewrite the old URL to the new one internally via the following rule:

RewriteEngine  onRewriteRule    "^/foo\.html$"  "/bar.html" [PT]


Arun Patidar

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

You can check this

https://httpd.apache.org/docs/2.4/rewrite/remapping.html 

 

From Old to New (internal)

Description:

Assume we have recently renamed the page foo.html to bar.html and now want to provide the old URL for backward compatibility. However, we want that users of the old URL even not recognize that the pages was renamed - that is, we don't want the address to change in their browser.

Solution:

We rewrite the old URL to the new one internally via the following rule:

RewriteEngine  onRewriteRule    "^/foo\.html$"  "/bar.html" [PT]


Arun Patidar

Avatar

Community Advisor

Hi @raushan123 ,

You can try this approach, use the [P] flag instead of the [PT] flag in your RewriteRule. The [P] flag stands for Proxy and allows for internal server redirection without revealing the target URL to the client.

Here's an updated version of your RewriteRule:

 

RewriteRule ^/$ /content/whatsappsim/de/de/plp.html [P,L]

 

By using the [P] flag, the URL /content/whatsappsim/de/de/plp.html will be internally served without being displayed in the browser's address bar. Please note that for this to work, the Apache HTTP Server needs to be configured properly and have the necessary modules enabled (such as mod_proxy).

 

https://httpd.apache.org/docs/2.4/rewrite/flags.html