How to restrict apache dispatcher to allow published pages only?
We are migrating from AEM 6.0 to AEM 6.3. As a phased migration, we are placing RewriteRule condition at apache that
- If URI matches to migrated page, continue to 6.3 publisher.
- If URI is not in list of migrated pages, redirect to 6.0 domain.
Currently the list of migrated pages in RewriteCondition is manually edited. When authoring team migrate a page, a developer adds a new Rule in apache.
Requirement: The apache RewriteCondition should redirect to publisher for all published pages automatically. If a page is not available at publisher, it should automatically redirect to 6.0 domain.
Approaches: Currently a developer edits the RewriteCondition when author publish a new page. Proposal is use RewriteMap:
- A sling servlet will prepare the RewriteMap flat text file with list of published pages
- A cron job at apache server hits the servlet, pulls the list of published pages and places map file in correct path
- A single RewriteMap condition looks up the map file, if entry is found allows to publisher; else redirects to 6.0 domain.
Is this proposed solution correct? Is there any other recommended way for our problem statement?