我想了解sling url重寫的工作原理。我下面這個網址 -sling重寫器的工作原理澄清
http://www.cognifide.com/blogs/cq/multidomain-cq-mappings-and-apache-configuration/
步驟我已經做了在發佈環境 -
/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)然而,當,我打這個網址:
http://localhost:4503/products.html then I got 404 error.
2)此外,我想執行時,用戶擊中第是網址:
http://localhost:4503/content/geometrixx/en.html then it should open
http://localhost:4503/en/products.html.
請讓我知道是否有可能按照上述方法
更新: 我試圖通過調度來訪問。我在Windows 7 CQ5.6.0上使用Apache 2.0。我的httpd.conf看起來像下面 -
<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)現在,當我打:本地主機/內容/ geometrixx/EN/products.html放在然後我得到的頁面和調度員也緩存頁面。但是,如果我導航到任何頁面,例如產品 - >三角形,那麼由於Sling映射,URL將變爲localhost:4503/products/triangle.html。這是預期的嗎?由於派遣不知道Sling映射,因此它不會緩存triangle.html。如何使調度緩存工作? 4)作爲重寫規則存在(RewriteRule^/(。*)$/content/geometrixx/en/$ 1 [PT,L]),如果我打這個url localhost/triangle.html,那麼我應該得到正確的頁面作爲localhost/content/geometrixx/en/triangle.html但我得到404錯誤。
有人可以幫忙嗎? –