Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Regarding Vanity URLS

Avatar

Level 3

Hi,

we have a two domains like plan.rajasthan.gov.in,energy.rajasthan.gov.in
i want to use vanity url "/department" for both domain name redirecting to diffrent sites 
(ex:-plan.rajasthan.gov.in/department redirect to it inner webiste as planning department and energy.rajasthan.gov.in/department redirect to it inner webiste as energy department ) can we config same vanity name for two diffrent webistes redirecting to diffrent sites .if possible please help us to resolve this problem.

 

Thanks,

Veera 

7 Replies

Avatar

Level 10

It should work. Configure the vanity url as '/department' in the page properties of the respective pages.

Hope, both the subdomains are different sites in AEM and the same has been configured in dispatcher.

Avatar

Employee

Hi,

I don't think this will be possible, Try it yourself with the gemoetrixx sites. 

if you consider an AEM instance with many sites, then all the vanity URL's are stored together, not per site, so if you define two vanity urls with the same value, you cannot guarantee which path will be resolved. 

There are at least two ways in which you could address this: prepending a identifier to the vanity url, or handling incoming requests for vanity url's at the dispatcher level:

Using the prefix method, for all vanity URL's the authors must add a prefix, so in your case you would use: "/plan/department" and "/energy/department".

If you wanted to do this at the dispatcher level, you would have to add a rule for the specific vanity URL, so that when the URL "/department" comes into the dispatcher configuration for "plan.rajasthan.gov.in"It gets resolved to a path for the plan site. The big issue with this is that authors cannot set the vanity url themselves, they have to get the development team to add a tule for every vanity url directly in the dispatcher config.

Regards,

Opkar

Avatar

Level 2

One way is to give authors a convention to follow for vanity url's - Say prefix dept name before vanity path so that authors can define vanity paths as 
for page plan.rajasthan.gov.in/department - plan/department & 
for page energy.rajasthan.gov.in/department - energy/department

You can then use dispatcher to rewrite plan.rajasthan.gov.in/department to map to plan/department & energy.rajasthan.gov.in/department to map to energy/department

Avatar

Level 3

hi

    Thank you reverting me on my previous mail please let me know where should i add  rewriterule, Please find below  my httpd.vhosts.conf  file

<VirtualHost *:80>
    ServerAdmin webmaster@plan.rajasthan.gov.in
    
    ServerName plan.rajasthan.gov.in
    ServerAlias www.plan.rajasthan.gov.in
    
    DocumentRoot "/rajasthan/cache"
    
        # rewrite log
    #RewriteLog "logs/rewrite-http-plan.log"
    #RewriteLogLevel 9

    RewriteEngine On


     # If we have a request for the root URL /
     # we redirect to the en language version of a home page with a HTTP 301
     RewriteRule     ^/$    /content/planning-portal/en.html   [R=301,L]
    
    #ErrorLog "logs/plan.rajasthan.gov.in-error.log"
    #CustomLog "logs/plan.rajasthan.gov.in-access.log" common
</VirtualHost>

and this is my vanitypath config:   /00364 {/type "allow" /glob "* /department*"}

Avatar

Level 3

hi

    Thank you reverting me on my previous mail please let me know where should i add  rewriterule, Please find below  my httpd.vhosts.conf  file

<VirtualHost *:80>
    ServerAdmin webmaster@plan.rajasthan.gov.in
    
    ServerName plan.rajasthan.gov.in
    ServerAlias www.plan.rajasthan.gov.in
    
    DocumentRoot "/rajasthan/cache"
    
        # rewrite log
    #RewriteLog "logs/rewrite-http-plan.log"
    #RewriteLogLevel 9

    RewriteEngine On


     # If we have a request for the root URL /
     # we redirect to the en language version of a home page with a HTTP 301
     RewriteRule     ^/$    /content/planning-portal/en.html   [R=301,L]
    
    #ErrorLog "logs/plan.rajasthan.gov.in-error.log"
    #CustomLog "logs/plan.rajasthan.gov.in-access.log" common
</VirtualHost>

and this is my vanitypath config:   /00364 {/type "allow" /glob "* /department*"}

Avatar

Employee

This feature isn't available in the product yet but you may use the following approach to complete this requirement

  • Add an extra field in the page properties instead of sling:vanityPath
  • Using that field they add /content/siteA to the front of the sling:vanityPath before saving it to the sling:vanityPath property
  • This would distinguish between content hierarchy for multiple sites
  • Configure the rewrite rules in accordance to the setting above See (1)

(1) : https://www.cognifide.com/our-blogs/cq/multidomain-cq-mappings-and-apache-configuration

HI,

i'm facing the issue in the vanity url. Looking for the permanent Fix.

When users use vanity urls when they are not logged in they get redirected to an error page instead of the login page.
Users should be redirected to the login page and then the event page if not logged in. If users are logged in it should redirect them directly to the event page