Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Enabling Apache Rewrite Module on AEM Cloud Instances

Avatar

Level 8

Hi All,

 

I have deployed my vhost file on AEM Cloud which is working fine for most part save the redirection rules.

Snippet from vhost file - 

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^/$ /content/xyz/us/en/home-page.html [PT,L]

RewriteRule    "^/content/xyz/us/en/home-page.html"  "/content/xyz/us/en/xyz-home-page.html" [PT]

 

# Add .html extension when extension is missing from request
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]*[^./])$ $1.html [R=301,L]

 

As you can see I have written 3 redirects here - 

1. Redirecting Root URL '/' to home-page.html

2. Redirecting Page A to Page B

3. Adding .html when missing in request

 

None of these redirects are working.

 

Previously on Apache Webserver, we had to uncomment rewrite module in /etc/apache2/httpd.conf.

But with Cloud Instance we no longer have access to those configuration files.

 

Does Adobe enable the rewrite module by default on the webserver ? 

or Does it have to be manually enabled by raising a ticket ?

 

Can anyone please advise on this ?

@Jaideep_Brar , @Nupur_Jain , @arunpatidar , @kautuk_sahni 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

It does have the rewrite module enabled

<IfModule mod_rewrite.c>
		RewriteEngine	on
		Include conf.d/rewrites/rewrite.rules

		# Rewrite index page internally, pass through (PT)
		RewriteRule "^(/?)$" "/index.html" [PT]

	</IfModule>

You must try updating rewrite rules in conf.d/rewrites/rewrite.rules file
I have tested this with aem-dispatcher-sdk
more info on how to use dispatcher-sdk which is replica of AEMaaCS dispatcher configuration.

https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/local-development-env... 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi,

It does have the rewrite module enabled

<IfModule mod_rewrite.c>
		RewriteEngine	on
		Include conf.d/rewrites/rewrite.rules

		# Rewrite index page internally, pass through (PT)
		RewriteRule "^(/?)$" "/index.html" [PT]

	</IfModule>

You must try updating rewrite rules in conf.d/rewrites/rewrite.rules file
I have tested this with aem-dispatcher-sdk
more info on how to use dispatcher-sdk which is replica of AEMaaCS dispatcher configuration.

https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/local-development-env... 

Avatar

Level 8

Hi @arunpatidar , Thanks for your response.

Putting the rewrite rule in the rules file worked as against putting it in vhost file.

However, in another thread as discussed I am unable to separate the rewrite rules file for different sites even with the opt-in folder and USE_SOURCES_DIRECTLY file present.

I am getting the file cannot be found when I run dispatcher validator in non-relaxed mode.

 

When deployed on cloud instance, the rewrite rule is not redirecting the pages as expected.
Any help on this ?
Original Link - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-have-more-than-1-re...