URL rewrite/shortening not working in Dispatcher | Community
Skip to main content
vishalp01051978
Level 2
January 19, 2016
Solved

URL rewrite/shortening not working in Dispatcher

  • January 19, 2016
  • 3 replies
  • 3165 views

When I use PT or L flag, my URL shortening is not working. It only works with R flag. R flag is for URL redirecting, but I need internal rewrite. I am using apache 2.2 on Linux. I have mode_rewrite.so and mod_proxy.so in my modules directory.

RewriteEngine on 
RewriteCond %{REQUEST_URI} !^/content/dam 
RewriteRule ^/(.*) /content/dam/$1 [L]

I am trying to shorten URL from 

http://serverx.epga.nam.com:15100/content/dam/parts/images/22787711_Primary.jpg

to 

http://serverx.epga.nam.com:15100/parts/images/22787711_Primary.jpg

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

Hi,

typically, the user would enter the shortened URL: http://serverx.epga.nam.com:15100/parts/images/22787711_Primary.jpg which would then get rewritten to the full path in Dispatcher: /content/dam/parts/images/22787711_Primary.jpg this expanded URL would then be passed onto AEM (if it was not already cached)

Shortening URL's from /content/dam/parts/images/22787711_Primary.jpg to /parts/images/22787711_Primary.jpg is done during rendering

Also check your dispatcher log file, you can increase the level of logging to get more details.

Regards,

Opkar

3 replies

Jitendra_S_Toma
Level 10
January 20, 2016

Hi Vishal,

Here are the very nice docs which explain each & every in details. Try below rule if it solves your problem.

http://serverfault.com/questions/214512/redirect-change-urls-or-redirect-http-to-https-in-apache-everything-you-ever

https://httpd.apache.org/docs/2.2/rewrite/flags.html

RewriteEngine on 
RewriteCond %{REQUEST_URI} !^/content/dam 
RewriteRule ^/(.*)$  /content/dam/$1 [L]

Jitendra

kautuk_sahni
Community Manager
Community Manager
January 20, 2016

[EDITED]

Hi 

Some reference links to start with :-

Link:- https://docs.adobe.com/docs/en/dispatcher/disp-domains.html#AEM Rewrites Incoming URLs

file

The Dispatcher cache mirrors the repository node structure. Therefore, when page activations occur  the resulting requests for invalditing the cached page require no URL or path translations. 

file

Link:- http://stackoverflow.com/questions/21662780/how-sling-rewriter-works-clarification

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

// This post is intended to serve as a quick referecnce document wherein you can learn how to configure 3 language versions of the well-known Geometrixx site to work on 3 domains: geometrixx.com, geometrixx.de and geometrixx.fr

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
ogillAdobe EmployeeAccepted solution
Adobe Employee
January 20, 2016

Hi,

typically, the user would enter the shortened URL: http://serverx.epga.nam.com:15100/parts/images/22787711_Primary.jpg which would then get rewritten to the full path in Dispatcher: /content/dam/parts/images/22787711_Primary.jpg this expanded URL would then be passed onto AEM (if it was not already cached)

Shortening URL's from /content/dam/parts/images/22787711_Primary.jpg to /parts/images/22787711_Primary.jpg is done during rendering

Also check your dispatcher log file, you can increase the level of logging to get more details.

Regards,

Opkar