Hi Team,
We received a customer request for redirecting a non-www to www
abc.com (any page) should redirect (301) to www.abc.com
Can I have some suggestion for implementing this redirection rule.
Thanks in advance!
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @AnushaAt
If you are using AEMaaCS with OOTB Fastly CDN, you can utilize the Server-side Redirects in the CDN Configuration :
https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/con...
Example -
kind: "CDN"
version: "1"
metadata:
envTypes: ["prod", "dev"]
data:
redirects:
rules:
- name: redirect-non-www-to-www
when: { reqProperty: host, equals: "abc.com" }
action:
type: redirect
status: 301
location: https://www.abc.com{{ reqProperty: path }}
or you can handle the redirection at the Dispatcher Level :
RewriteCond %{HTTP_HOST} ^abc\.com$ [NC]
RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L]
Hi @AnushaAt ,
You can try adding the following rewrite rules to your dispatcher configuration:
RewriteCond %{HTTP_HOST} ^abc\.com$ [NC]
RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L]
This will redirect abc.com to www.abc.com.
Let me know if it works.
Thanks.
Hello @AnushaAt
If you are using AEMaaCS with OOTB Fastly CDN, you can utilize the Server-side Redirects in the CDN Configuration :
https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/con...
Example -
kind: "CDN"
version: "1"
metadata:
envTypes: ["prod", "dev"]
data:
redirects:
rules:
- name: redirect-non-www-to-www
when: { reqProperty: host, equals: "abc.com" }
action:
type: redirect
status: 301
location: https://www.abc.com{{ reqProperty: path }}
or you can handle the redirection at the Dispatcher Level :
RewriteCond %{HTTP_HOST} ^abc\.com$ [NC]
RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L]
Hi @AnushaAt ,
Dispatcher (Apache) Redirect Rule
If you're using AEM Dispatcher (Apache HTTP Server), add the following to your dispatcher/src/conf.d/rewrites/rewrite.rules file:
# Redirect non-www to www (permanent 301)
RewriteCond %{HTTP_HOST} ^abc\.com$ [NC]
RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L]
AEM Cloud (Fastly CDN) Configuration
If you're on AEM as a Cloud Service, use Fastly Redirect Rules via CDN Configuration YAML:
kind: "CDN"
version: "1"
metadata:
envTypes: ["prod", "stage"]
data:
redirects:
rules:
- name: redirect-non-www-to-www
when:
reqProperty: host
equals: "abc.com"
action:
type: redirect
status: 301
location: https://www.abc.com{{ reqProperty: path }}
Add this to your CDN Config repository (conf/cdn/redirects.yaml), and deploy via Cloud Manager pipeline.
Regards,
Amit
Views
Replies
Total Likes
To implement a redirect from non-www to www (e.g. abc.com → www.abc.com), the industry-standard and most reliable approach in AMS/AEM environments is to use an Apache mod_rewrite rule at the Dispatcher (or web server) layer.
Add the following to your appropriate rewrite configuration file (commonly included in your vhost definition, e.g., /etc/httpd/conf.d/rewrites/base_rewrite.rules in AMS):
RewriteEngine On # Redirect ONLY non-www to www for any page, preserving the path and query string RewriteCond %{HTTP_HOST} ^abc\.com [NC] RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L]
Some teams also add redirects at the CDN layer (e.g., CloudFront, Akamai) or, in Azure, use the Application Gateway's redirect features, though this usually requires AMS or platform team involvement for changes and isn’t as self-service as the Dispatcher.
Best Practice:
@AnushaAt Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
@AnushaAt Just checking in — were you able to resolve your issue?
We’d love to hear how things worked out. If the suggestions above helped, marking a response as correct can guide others with similar questions. And if you found another solution, feel free to share it — your insights could really benefit the community. Thanks again for being part of the conversation!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies