Dispatcher mod_rewrite not working? | Community
Skip to main content
daitienshi
Level 2
August 23, 2017
Solved

Dispatcher mod_rewrite not working?

  • August 23, 2017
  • 12 replies
  • 5890 views

Related to another post (AEM Dispatcher not resolving vanity urls),​ I've created some rewrite rules in my httpd.conf in my dispatcher so that when I hit my site's root (e.g. www.mysite.com/), it should rewrite/redirect to a page of my choosing (e.g. www.mysite.com/content/mysite/login.html).

However, when I hit the root, I'm getting a response with a redirect (302) to /index.html instead, even though I've created a rewrite rule for this.

In my httpd.conf, I have:

Ideally, what I'd like is a combination of vanity urls and rewrite so that anything that hits the root get redirected to the vanity url, which I had tried to set up by configuring the sling:redirect property of the /content node, but the dispatcher keeps returning index.html instead of the value of the sling:redirect.

Thanks!

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 joerghoh

In the second case the dispatcher still forwards the request to AEM, although it should not. Have you restarted the httpd to make that change effective?

If yes, please provide all webserver configuration (including dispatcher config) for both cases and report an issue with AEM support.

Jörg

12 replies

Level 4
January 17, 2018

Thanks daitienshi​,

I added a sling internal redirect, to handle request matching e.g. localhost.4503/$.  While the mapping worked ok when accessing the publish instance directly, i.e. http://localhost:4503 internally redirects as i'd hope to, when accessing via apache/dispatcher the dispatcher logs out a 302 http response and subsequently tries to GET /index.html.

I have a dispatcher.any allow filter - i imagine similar to what you were trying - such as

and I'm not using SSL.

I'm struggling to understand what returns the 302 when requesting the '/' resource?  Is there simply no mapping and redirect to cater for the request from apache/dispatcher (i.e. will localhost.4503 only serve requests that are made directly to the publisher with the port included?)?

I'm sure this is simple! Any guidance appreciated?

Level 4
January 18, 2018

Answering my own question(s), index.html returned when '/' not matched by any etc/map rules and root mapping servlet handles the request.