Nivel 1
Nivel 2
Iniciar sesión en la comunidad
Iniciar sesión para ver todas las insignias
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!
¡Resuelto! Ir a solución.
Vistas
Respuestas
Total de me gusta
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]
Vistas
Respuestas
Total de me gusta
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.
Vistas
Respuestas
Total de me gusta
Hi @AnushaAt
Which CDN are you using? It will be easier/best practice to implement directly at CDN.
Vistas
Respuestas
Total de me gusta
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]
Vistas
Respuestas
Total de me gusta
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
Vistas
Respuestas
Total de me gusta
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:
Vistas
Respuestas
Total de me gusta
@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!
Vistas
Respuestas
Total de me gusta
@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!
Vistas
Respuestas
Total de me gusta
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas