Expand my Community achievements bar.

SOLVED

URL Mangling Problem

Avatar

Level 1

I have been trying to setup URL mangling for my domain, in 5.6, to remove the /content/geometrixx/en portion from the URL. I have followed the great guide here:

http://www.cognifide.com/blogs/cq/multidomain-cq-mappings-and-apache-configuration/

Unfortunately when I add the resource.resolver.map.location parameter in publishing to point to the /etc/map.publish folder any resource I request, be it from the geometrixx.com domain, or localhost, the response comes back as a 503 and redirects me to a login page which won't show because it is also getting a 503. If I remove the resource resolver property everything goes back to normal and I can browse my site just fine. I can go into the Sling Resource Resolver OSGi tool and it will correctly map the URLs back and forth, so I know the mappings are done correctly.

Any help on this subject would be greatly appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 7

I've checked my configuration and there are some differences between it and your. I'll paste it here for you and you can compare and maybe see if the changes can help:


On the publisher

. /etc/map.publish (sling:Folder)
. . /http (sling:orderedFolder)
. . . test.mydomain.myserver_com (sling:Mapping) => properties (sling:internalRedirect = "/content/mysite/en.html", sling:match="test.mydomain.myserver.com/$")
. . . test.mydomain.myserver.com (sling:Mapping) => properties (sling:internalRedirect = "/content/mysite")
. . . . redirect (sling:Mapping) => properties (sling:internalRedirect = "/content/mysite/$1, /$1", sling:match="(.+)$")

In my vhost config file
RewriteEngine On
RewriteRule ^/$ /content/mysite/en/start.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/mysite/$1 [PT,L]

RewriteCond $1 ^content/usergenerated
RewriteRule ^(.*) /content/$1 [L]

RewriteCond %{REQUEST_URI} !^/content/campaigns
RewriteCond %{REQUEST_URI} !^/content/dam
RewriteCond %{REQUEST_URI} ^/content
RewriteRule !^/content/mysite - [R=404,L,NC]

 

 

Good Luck
/Johan

View solution in original post

4 Replies

Avatar

Level 10

Have you read all the sling documentation on this subject -- for example:

http://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html

Are you sure that you configured everything properly?

 

Avatar

Level 7

Can you please supply how your configurations look like.
It would be much easier to see where the problem lies,
both the dispatcher and map.publish/http/ files.

Regards
/Johan

Avatar

Level 1

Here is some more information...

This is my /etc/map.publish json

{ hidden: "true", jcr: createdBy: "admin", jcr: created: "Tue Sep 17 2013 23:54:26 GMT-0400", jcr: primaryType: "sling:OrderedFolder", http: { jcr: createdBy: "admin", jcr: created: "Tue Sep 17 2013 23:54:26 GMT-0400", jcr: primaryType: "sling:OrderedFolder", www_geometrixx_com: { jcr: createdBy: "admin", sling: internalRedirect: ["/content/geometrixx/en.html"], jcr: created: "Tue Sep 17 2013 23:54:26 GMT-0400", jcr: primaryType: "sling:Mapping", sling: match: "www.geometrixx.com/$" }, www.geometrixx.com: { jcr: createdBy: "admin", sling: internalRedirect: ["/content/geometrixx/en"], jcr: created: "Tue Sep 17 2013 23:54:26 GMT-0400", jcr: primaryType: "sling:Mapping", redirect: { jcr: createdBy: "admin", sling: internalRedirect: ["/content/geometrixx/en/$1","/$1"], jcr: created: "Tue Sep 17 2013 23:54:26 GMT-0400", jcr: primaryType: "sling:Mapping", sling: match: "(.+)$" } } } }

These are my rewrite rules:

RewriteRule ^/$ /content/geometrixx/en.html [PT,L] RewriteCond %{REQUEST_URI} ^/content RewriteCond %{REQUEST_URI} !^/content/campaigns RewriteCond %{REQUEST_URI} !^/content/dam RewriteRule !^/content/geometrixx/en - [R=404,L,NC] 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]

And here is my dispatcher.any:

/farms { /website { /clientheaders { "*" } /virtualhosts { "*" } /renders { /rend01 { /hostname "localhost" /port "4503" } } /filter { # Deny everything first and then allow specific entries #      /0001 { /type "deny"  /glob "*" } /0001 { /type "allow"  /glob "*" } # Open consoles #     /0011 { /type "allow" /glob "* /admin/*"  }  # allow servlet engine admin #     /0012 { /type "allow" /glob "* /crx/*"    }  # allow content repository #     /0013 { /type "allow" /glob "* /system/*" }  # allow OSGi console # Allow non-public content directories /0021 { /type "allow" /glob "* /apps/*"   }  # allow apps access #     /0022 { /type "allow" /glob "* /bin/*"    } /0023 { /type "allow" /glob "* /content*" }  # disable this rule to allow mapped content only #     /0024 { /type "allow" /glob "* /libs/*"   } #     /0025 { /type "deny"  /glob "* /libs/shindig/proxy*" } # if you enable /libs close access to proxy #     /0026 { /type "allow" /glob "* /home/*"   } #     /0027 { /type "allow" /glob "* /tmp/*"    } #     /0028 { /type "allow" /glob "* /var/*"    } # Enable specific mime types in non-public content directories /0041 { /type "allow" /glob "* *.css *"   }  # enable css /0042 { /type "allow" /glob "* *.gif *"   }  # enable gifs /0043 { /type "allow" /glob "* *.ico *"   }  # enable icos /0044 { /type "allow" /glob "* *.js *"    }  # enable javascript /0045 { /type "allow" /glob "* *.png *"   }  # enable png /0046 { /type "allow" /glob "* *.swf *"   }  # enable flash /0047 { /type "allow" /glob "* *.jpg *"   }  # enable jpg /0048 { /type "allow" /glob "* *.jpeg *"  }  # enable jpeg /0049 { /type "allow" /glob "* *.ttf *"   }  # enable fonts /0050 { /type "allow" /glob "* *.svg *"   }  # enable fonts/vector graphics /0051 { /type "allow" /glob "* *.eot *"   }  # enable fonts /0052 { /type "allow" /glob "* *.woff *"  }  # enable fonts /0053 { /type "allow" /glob "* *.json *"  }  # enable hard coded json # Enable features /0062 { /type "allow" /glob "* /libs/cq/personalization/*"  }  # enable personalization # Deny content grabbing /0081 { /type "deny"  /glob "GET *.infinity.json*" } /0082 { /type "deny"  /glob "GET *.tidy.json*"     } /0083 { /type "deny"  /glob "GET *.sysview.xml*"   } /0084 { /type "deny"  /glob "GET *.docview.json*"  } /0085 { /type "deny"  /glob "GET *.docview.xml*"  } /0086 { /type "deny"  /glob "GET *.*[0-9].json*" } #     /0087 { /type "allow" /glob "GET *.1.json*" }          # allow one-level json requests # Deny query /0090 { /type "deny"  /glob "* *.query.json*" } } /cache { /docroot "/www/vhosts/cqdispatcher" #/statfileslevel "0" #/allowAuthorized "0" #/serveStaleOnError "0" /rules { /0000 { /glob "*" /type "allow" } } /invalidate { /0000 { /glob "*" /type "deny" } /0001 { /glob "*.html" /type "allow" } /0002 { /glob "/etc/segmentation.segment.js" /type "allow" } /0003 { /glob "*/analytics.sitecatalyst.js" /type "allow" } } /allowedClients { } } /statistics { /categories { /html { /glob "*.html" } /others { /glob "*" } } } } }

And finally my dispatcher apache configuration

LoadModule dispatcher_module  modules/mod_dispatcher.so <IfModule disp_apache2.c> DispatcherConfig conf/dispatcher.any DispatcherLog '|/opt/apache/latest/bin/rotatelogs logs/dispatcher.%Y%m%d.log 86400 -240' DispatcherLogLevel 3 DispatcherNoServerHeader 1 DispatcherDeclineRoot 0 DispatcherUseProcessedURL 1 </IfModule>

Any help you could provide would be greatly appreciated.

Thanks

Avatar

Correct answer by
Level 7

I've checked my configuration and there are some differences between it and your. I'll paste it here for you and you can compare and maybe see if the changes can help:


On the publisher

. /etc/map.publish (sling:Folder)
. . /http (sling:orderedFolder)
. . . test.mydomain.myserver_com (sling:Mapping) => properties (sling:internalRedirect = "/content/mysite/en.html", sling:match="test.mydomain.myserver.com/$")
. . . test.mydomain.myserver.com (sling:Mapping) => properties (sling:internalRedirect = "/content/mysite")
. . . . redirect (sling:Mapping) => properties (sling:internalRedirect = "/content/mysite/$1, /$1", sling:match="(.+)$")

In my vhost config file
RewriteEngine On
RewriteRule ^/$ /content/mysite/en/start.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/mysite/$1 [PT,L]

RewriteCond $1 ^content/usergenerated
RewriteRule ^(.*) /content/$1 [L]

RewriteCond %{REQUEST_URI} !^/content/campaigns
RewriteCond %{REQUEST_URI} !^/content/dam
RewriteCond %{REQUEST_URI} ^/content
RewriteRule !^/content/mysite - [R=404,L,NC]

 

 

Good Luck
/Johan