I am trying to understand how sling url rewrite works. I'm following this url -
http://www.cognifide.com/blogs/cq/multidomain-cq-mappings-and-apache-configuration/
Steps I've done in publish environment -
/etc/map.publish/http:
jcr: primaryType: "sling:OrderedFolder",
home: {
sling:internalRedirect: ["/content/geometrixx/en.html"],
jcr:primaryType: "sling:Mapping",
sling:match: "localhost:4503/$"
},
localhost.4503: {
sling:internalRedirect: ["/content/geometrixx/en"],
jcr:primaryType: "sling:Mapping",
redirect: {
sling:internalRedirect: ["/content/geometrixx/en/$1","/$1"],
jcr:primaryType: "sling:Mapping",
sling:match: "(.+)$"
}
}
1) However, when I hit this url :
http://localhost:4503/products.html then I got 404 error.
2) Moreover, I want to implement when user hit on this url :
http://localhost:4503/content/geometrixx/en.html then it should open
http://localhost:4503/en/products.html.
Please let me know is it possible by following the above approach
Update: I'm trying to access through dispatcher. I'm using Apache 2.0 on windows 7, CQ5.6.0. My httpd.conf looks like below -
<IfModule disp_apache2.c>
DispatcherConfig conf/dispatcher.any
DispatcherLog logs/dispatcher.log
DispatcherLogLevel 3
DispatcherNoServerHeader 0
DispatcherDeclineRoot 0
DispatcherUseProcessedURL 0
DispatcherPassError 0
</IfModule>
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/Apache2/htdocs/content/sitea"
RewriteEngine On
RewriteRule ^/$ /content/geometrixx/en.html [PT,L]
RewriteCond %{REQUEST_URI} !^/apps
RewriteCond %{REQUEST_URI} !^/content
RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{REQUEST_URI} !^/home
RewriteCond %{REQUEST_URI} !^/libs
RewriteCond %{REQUEST_URI} !^/tmp
RewriteCond %{REQUEST_URI} !^/var
RewriteRule ^/(.*)$ /content/geometrixx/en/$1 [PT,L]
<Directory "C:/Apache2/htdocs/content/sitea">
<IfModule disp_apache2.c>
SetHandler dispatcher-handler
ModMimeUsePathInfo On
</IfModule>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
3) Now, when I hit : localhost/content/geometrixx/en/products.html then I get the page and dispatcher also cache the page. But after if I navigate to any page for example Products ->Triangle then URL becomes localhost:4503/products/triangle.html due to Sling mapping. is this expected? As dispatch does not know about Sling mapping hence it does not cache triangle.html. How to make dispatcher cache work?
4) As the rewriter rule is there(RewriteRule ^/(.*)$ /content/geometrixx/en/$1 [PT,L]), if I hit this url localhost/triangle.html then I should get the proper page as localhost/content/geometrixx/en/triangle.html but I get 404 error.