Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to programmatically disable URL rewriting?

Avatar

Level 7

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.

1 Accepted Solution

Avatar

Correct answer by
Level 10

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

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

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

Avatar

Level 7

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.

Avatar

Level 10

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.