I have two domains and content path something like below domain1.com/content/abc/en-US/home.html, domain2.com/content/xyz/kr-KR/home.html
i have defined below URL mapping configuration inside CQ publish instance -->Felix console-->Apache Sling resolver factory
/content/abc/:/ /content/xyz/:/
The above configuration removing the /content/abc,/cotent/xyz from the URL(shortening the URL) i have rewrite rule defined to redirect www.domain1.com to domain1.com/en-US/home.html and www.domain2.com to domain2.com/kr-KR/home.html..all these working fine..
But my problem is ,i can also able to access domain2.com/en-US/home.html from domain2 though i don't have en-US inside domain2(we should see 404 page). how do i restrict this . i know it's happening because of resource resolver mapping. Any help would be appreciate!!! pls let me know if you're not clear about my question..
This is some thing that needs to be controlled at the web server level. The domain only takes the request to CQ's server.Since both domains point to the same server , as long as the path resolves to a correct location it will return the page. Cognifide's blog has a great post on this. Here is an excerpt from that blog that is relevant to your question
Because users are able to enter a full content path after a given domain name, e.g. geometrixx.com/content/geometrixx/en/products.html, they may as well get a page that belongs to some other domain, e.g. geometrixx.com/content/geometrixx/fr/products.html. In order to avoid such a situation, we need to check all requests for path beginning with /content and reject these which are not related to any campaign, DAM or a current domain:
RewriteCond %{REQUEST_URI} ^/content
RewriteCond %{REQUEST_URI} !^/content/campaigns
RewriteCond %{REQUEST_URI} !^/content/dam
RewriteRule !^/content/geometrixx/en - [R=404,L,NC]
It makes use of apache httpd re-write module to send 404 responses when pages that aren't supposed to be on that domain are requested. The link to the blog post is multidomain mapping in cq5