How to programmatically disable URL rewriting? | Community
Skip to main content
LinearGradient
Level 6
October 16, 2015
Solved

How to programmatically disable URL rewriting?

  • October 16, 2015
  • 3 replies
  • 1386 views

Hi,

We have, say, an entry under /etc/map that converts <a href="https://forums.adobe.com/content/foo/products.html>Products</a> to <a href="http://www.example.com/products">Products</a>.

Looks like some services, like Link Checker, can be disabled programmatically:

<% org.apache.sling.runmode.RunMode runmode = sling.getService(org.apache.sling.runmode.RunMode.class); String[] runmodes = runmode.getCurrentRunModes(); boolean isPublish = false; String [] expectedRunModes = {"publish"}; if(runmode.isActive(expectedRunModes)) { isPublish = true; } if(isPublish) { LinkCheckerSettings s = LinkCheckerSettings.fromRequest(slingRequest); s.setIgnoreExternals(true); } %>

Is it possible to programmatically disable URL rewriting as well?

Thanks in advance.

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 Sham_HC

Hi LinearGradient,

You can but it disables for entire page. Instead use x-cq-linkchecker="skip" in the <a> tag.

Thanks,
Sham
Tweet: @adobe_sham

3 replies

Sham_HC
Sham_HCAccepted solution
Level 10
October 16, 2015

Hi LinearGradient,

You can but it disables for entire page. Instead use x-cq-linkchecker="skip" in the <a> tag.

Thanks,
Sham
Tweet: @adobe_sham

LinearGradient
Level 6
October 16, 2015

Sham HC wrote...

Hi LinearGradient,

You can but it disables for entire page. Instead use x-cq-linkchecker="skip" in the <a> tag.

Thanks,
Sham
Tweet: @adobe_sham

 

Hi Sham,

Would this also disable transforming the link from /content/foo/a/b/c/service.html to www.example.com/service.html or will it only disable link checking?

Thanks.

Sham_HC
Level 10
October 16, 2015

LinearGradient wrote...

Sham HC wrote...

Hi LinearGradient,

You can but it disables for entire page. Instead use x-cq-linkchecker="skip" in the <a> tag.

Thanks,
Sham
Tweet: @adobe_sham

 

Hi Sham,

Would this also disable transforming the link from /content/foo/a/b/c/service.html to www.example.com/service.html or will it only disable link checking?

Thanks.

 


no rewrite happens. So both transform & checking will be skipped.