Rewrite Rule for a specific page | Community
Skip to main content
Level 3
August 17, 2023
Solved

Rewrite Rule for a specific page

  • August 17, 2023
  • 3 replies
  • 1150 views

Hi,

 

I need to redirect a specific page to the home page(root domain).

 

The current redirect for the home page that's below is working fine: Whenever I hot the domain https://www.domain.com serves the page 

## Home Page
RewriteRule ^/?$ /content/appname/us/en/home.html [PT,L]

 

## Rewrite rules for US site root pages
RewriteRule ^/content/appname/us/en/home/(.*).html$ /$1 [R=301,L]

 

There are a bunch of pages that are using Core Breadcrumb component and it follows the structure of:

Home > Devices > DeviceName

 

When Clicking on Home it should redirect to the root (#) instead it is trying to direct to /content/appname/us/en/home.html and in turn is throwing a 404

I added the below rule to redirect to the root (#) but still no luck

 

## Rewrite rule for Home Page
RewriteRule /content/appname/us/en/home.html ^/$ [R=301,L]

 

Can someone suggest how the vice-versa of the below should be working

## Home Page
RewriteRule ^/?$ /content/appname/us/en/home.html [PT,L]

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by sherinregi-1

Hi @manasabojja7 

You can try the below one also

RewriteRule ^content/appname/us/en/home.html / [R=301,L]

 

Also if you want to do trial and error please use the below URL 

https://technicalseo.com/tools/htaccess/

 

Hope it helps !

3 replies

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
August 17, 2023

Dis you try something like this:

RewriteRule ^content/appname/us/en/home\.html$ / [R=301,L]



Esteban Bustamante
Mahedi_Sabuj
Community Advisor
Community Advisor
August 17, 2023

Hi @manasabojja7

The same problem is being discussed in here: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/reverse-mapping-in-etc-map/m-p/258948#M40746 

You can try to a new node in /etc/map/https/www_domain_com that will map /content/appname/us/en/home.html to root (/) URL. 

{ "jcr:primaryType": "sling:Mapping", "sling:internalRedirect": "/content/appname/us/en/home.html", "sling:match": "www.domain.com/$" }

An example Sling mapping node definition

https://experienceleague.adobe.com/docs/experience-manager-learn/sites/seo/sitemaps.html?lang=en#absolute-sitemap-urls 

 

 

Mahedi Sabuj
sherinregi-1
Community Advisor
sherinregi-1Community AdvisorAccepted solution
Community Advisor
August 17, 2023

Hi @manasabojja7 

You can try the below one also

RewriteRule ^content/appname/us/en/home.html / [R=301,L]

 

Also if you want to do trial and error please use the below URL 

https://technicalseo.com/tools/htaccess/

 

Hope it helps !

Level 3
August 17, 2023

Thanks @sherinregi-1 @estebanbustamante 

 

The below rule worked

RewriteRule ^content/appname/us/en/home.html / [R=301,L]

 

Thank you, guys, for the help!