But even if the user enters the 3 URLs in the browser search, the entered URL always returns, that is, if he accesses by typing https://tooBB.com, https://tooBB.com will appear in the url field,
If he types in the search https://tooB.com.br https://tooB.com.br will appear.
What I mean is that when the user types in the search https://tooB.com.br or https://tooBB.com, the url is automatically changed to https://tooA.com
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @EvertonSa2,
that is expected, as both domains are added as aliases in your VHOST. Therefore, they are supported, not redirected. You should be able to achieve what you need with an Apache rewrite rule, something like:
# Redirect from tooB.com.br
RewriteCond %{HTTP_HOST} ^(www\.)?tooB\.com\.br$ [NC]
RewriteRule ^(.*)$ https://tooA.com/$1 [L,R=301]
# Redirect from tooBB.com
RewriteCond %{HTTP_HOST} ^(www\.)?tooBB\.com$ [NC]
RewriteRule ^(.*)$ https://tooA.com/$1 [L,R=301]
These are examples of 301 redirect rules that can be added to your too.vhost file.
Hope this helps,
Daniel
Hi @EvertonSa2,
that is expected, as both domains are added as aliases in your VHOST. Therefore, they are supported, not redirected. You should be able to achieve what you need with an Apache rewrite rule, something like:
# Redirect from tooB.com.br
RewriteCond %{HTTP_HOST} ^(www\.)?tooB\.com\.br$ [NC]
RewriteRule ^(.*)$ https://tooA.com/$1 [L,R=301]
# Redirect from tooBB.com
RewriteCond %{HTTP_HOST} ^(www\.)?tooBB\.com$ [NC]
RewriteRule ^(.*)$ https://tooA.com/$1 [L,R=301]
These are examples of 301 redirect rules that can be added to your too.vhost file.
Hope this helps,
Daniel
Hello @daniel-strmecki
So is this how I have to change my too.vhost ?
<VirtualHost *:80>
ServerName https://tooA.com
# Put names of which domains are used for your published site/content here
ServerAlias https://tooB.com.br https://tooBB.com
# Use a document root that matches the one in conf.dispatcher.d/default.farm
DocumentRoot "${DOCROOT}"
# URI dereferencing algorithm is applied at Sling's level, do not decode parameters here
AllowEncodedSlashes NoDecode
# Add header breadcrumbs for help in troubleshooting
<IfModule mod_headers.c>
Header add X-Vhost "publish"
</IfModule>
<Directory />
<IfModule disp_apache2.c>
# Some items cache with the wrong mime type
# Use this option to use the name to auto-detect mime types when cached improperly
ModMimeUsePathInfo On
# Use this option to avoid cache poisioning
# Sling will return /content/image.jpg as well as /content/image.jpg/ but apache can't search /content/image.jpg/ as a file
# Apache will treat that like a directory. This assures the last slash is never stored in cache
DirectorySlash Off
# Enable the dispatcher file handler for apache to fetch files from AEM
SetHandler dispatcher-handler
# Redirect from tooB.com.br
RewriteCond %{HTTP_HOST} ^(www\.)?tooB\.com\.br$ [NC]
RewriteRule ^(.*)$ https://tooA.com/$1 [L,R=301]
# Redirect from tooBB.com
RewriteCond %{HTTP_HOST} ^(www\.)?tooBB\.com$ [NC]
RewriteRule ^(.*)$ https://tooA.com/$1 [L,R=301]
</IfModule>
Hi @EvertonSa2
I believe what @daniel-strmecki explained should work and that you got it right in your example.
The only small question mrk I have in my mind is a about the need to have the [NC] or not at the end. That is for case-insensitive matching, but domains by default do not care about case sensitivity, so ..... not sure if really needed. But maybe I am wrong.....
For more Apache flags you can check docs: https://httpd.apache.org/docs/2.4/rewrite/flags.html
Hi @EvertonSa2,
please check the Apache documentation. I believe you are missing some config to enable rewrites first. Here is an example rewrite rule from my project:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteMap lowercase int:tolower
# Include general rewrite rules
# Include conf.d/rewrites/rewrite.rules
# Remove trailing slash
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^(.*)/+$ https://%{HTTP_HOST}$1 [R=301,L]
</IfModule>
Good luck,
Daniel
Hi @EvertonSa2
Are you using CDN, if yes then you can put redirects there and completely remove dispatcher config for 3rd domain.
Hi @arunpatidar
Do you have any documentation explaining how to perform this redirection via the CDN?
Hi @EvertonSa2,
it is documented here: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/con...
You can do redirects both on CDN and Apache, usually closer to the client is better - CDN.
Good luck,
Daniel
Hi @daniel-strmecki
Thanks for the help, I´ll take a look if it´s easier via the CDN.
Views
Likes
Replies