Doubt on Rewrite Rules, mod_expiry setting in Dispatcher-Apache setup | Community
Skip to main content
Level 9
October 16, 2015
Solved

Doubt on Rewrite Rules, mod_expiry setting in Dispatcher-Apache setup

  • October 16, 2015
  • 5 replies
  • 1024 views

Hi All,

We make use of windows environment. However, I am trying to understand what exactly is 

- httpd.conf

-Rewrite rules

-mod_expiry

w.r.t the above. Any detailed explanation/references will be really helpful.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ogill

When publish your content, you don't want to have the full path in your links. So you map /content/geometrixx/en/products.html to /geometrixx/en/products.html, you can do this using the jcr resource resolver[0], this will map outgoing links. However, you will run into issues with Dispatcher. Your incoming request http://myserver/geometrixx/en/products.html get's mapped to: /docroot/httdocs/geometrixx/en/products.html  

However when you activate the content, and try invalidate it in Dispatcher, dispatcher looks for the full content path: "/docroot/httdocs/content/geometrixx/en/products.html" So in order to cache/invalidate the requested URL to the correct path, you need to rewrite the incoming URL from the shortened version to the full path i.e. from "/geometrixx/en/products.html" to "/content/geometrixx/en/products.html" This is what is done with mod_rewrite

You can also use mod_rewrite to rewrite incoming requests for root "/" to /content/mysite/index.html"

 

Details taken from here: http://www.wemblog.com/2012/07/how-to-use-dispatcher-with-mapped.html

[0] https://docs.adobe.com/docs/en/aem/6-1/deploy/configuring/resource-mapping.html

Real world examples of:

http://aem.matelli.org/url-mapping-and-deep-linking/

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

5 replies

Adobe Employee
October 16, 2015

You can find all the details you require from the Apache HTTP Server documentation: 

http://httpd.apache.org/docs/2.2/configuring.html

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

Do you have a specific query?

askdctmAuthor
Level 9
October 16, 2015

Hi,

Thank you for your reply.

I am not getting as to why URL Re-write module is installed and configured [lets say on IIS]. What exactly is the purpose of it.

ogillAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

When publish your content, you don't want to have the full path in your links. So you map /content/geometrixx/en/products.html to /geometrixx/en/products.html, you can do this using the jcr resource resolver[0], this will map outgoing links. However, you will run into issues with Dispatcher. Your incoming request http://myserver/geometrixx/en/products.html get's mapped to: /docroot/httdocs/geometrixx/en/products.html  

However when you activate the content, and try invalidate it in Dispatcher, dispatcher looks for the full content path: "/docroot/httdocs/content/geometrixx/en/products.html" So in order to cache/invalidate the requested URL to the correct path, you need to rewrite the incoming URL from the shortened version to the full path i.e. from "/geometrixx/en/products.html" to "/content/geometrixx/en/products.html" This is what is done with mod_rewrite

You can also use mod_rewrite to rewrite incoming requests for root "/" to /content/mysite/index.html"

 

Details taken from here: http://www.wemblog.com/2012/07/how-to-use-dispatcher-with-mapped.html

[0] https://docs.adobe.com/docs/en/aem/6-1/deploy/configuring/resource-mapping.html

Real world examples of:

http://aem.matelli.org/url-mapping-and-deep-linking/

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

askdctmAuthor
Level 9
October 16, 2015

Hi,

Thanks a lot for the detailed explanation.

Also, can you please let me know about .

mod_expiry

- If there are any other such parameters and a brief explanation/reference to them.

Adobe Employee
October 16, 2015

askdctm wrote...

Hi,

Thanks a lot for the detailed explanation.

Also, can you please let me know about .

mod_expiry

- If there are any other such parameters and a brief explanation/reference to them.

 

I recommend you read this excellent tutorial on caching: https://www.mnot.net/cache_docs/

Mod_expires manipulates the Expires headers returned from the hosting server, letting you control how long a client's Web browser caches resources. You want to tune the duration of your caching to optimize performance while still considering how often you update the resource.

Also explained here in relation to static content which does not change: 

https://docs.adobe.com/docs/en/aem/6-1/deploy/configuring/expiration-static-objects.html

http://www.wemblog.com/2013/06/how-to-avoid-caching-of-static-files.html