问题
As an example, how would you achieve: a. Translate a hit to www.mysite.com to www.mysite.com/en and b. Translate the above www.mysite.com/en to /content/mysite/en.html
回答1:
Take a look at resource mapping:
- https://docs.adobe.com/docs/en/aem/6-2/deploy/configuring/resource-mapping.html
- https://docs.adobe.com/docs/en/dispatcher/disp-domains.html#URL%20Mapping
With mapping you can make it so the incoming URL (what the user sees in their browser) is one thing, but the URL that AEM sees when processing the incoming request is something else.
Also see:
- URL Mapping based on Resource resolver in AEM
- How to map urls?
- https://cqdump.wordpress.com/tag/etcmap/
回答2:
Here you go with an full example
- Have a look at the post on local dispatcher setup https://stackoverflow.com/questions/38954232/aem-security-environments-checklist/38955425#38955425
- Setting up the Localhost to domain name (w.r.t operating system windows7)
- Map the domain name with local dispatcher
- etc/maps setup in AEM for shortening of the content path ( remember we can have a number of variations for the etc/maps regex setup depends on your requirement.)
Localhost to domain name
Change the settings in the hosts file as below shown screenshot.
Add entries of your like name as the domain names as shown below example.
Access the project via the domain name as shown in the below screenshot. Your pages should be render as below.
Map the domain name with local dispatcher
Open the dispatcher.any
file (if you have separated the farms related to module open the specific site related farm file in my case it is)
Make sure your virtualhost allows your domain name in the below screenshot “*” represents to allow all hosts. (Else if you want to allow only the specific domain names specify instead of *)
Shortening of the content paths via the etc/maps
etc/maps nodes can be created manually as shown in below screenshots (Or you can create them by using some third party developed plugin http://cognifide.github.io/Carty/)
Add a virtual host entries in your dispatcher.any
file or in a separate virtualhost file.
In my case I have added them in a separate file. And enabled the file include in the httpd.conf file. Also enable the rewrite module else virtualhost file enrty rewrite will not work.
Make sure to pay attention on the highlighted rewrite rules and the SetHandler configurations, these are the crucial ones to render your page properly else the request might be stopped at dispatcher level itself not propagating to the publish instances of AEM.
That’s it once you done all the above configuration without any mistakes you should be able to see the domain name access of our home page. And all other pages should be rendered with short form of the urls by hiding the content paths that has been configured in etc/maps
来源:https://stackoverflow.com/questions/39151041/how-can-i-prevent-exposing-of-content-hiererchy-paths-within-aem-i-am-looking-f