Expand my Community achievements bar.

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

Making URL non-casesensitive

Avatar

Community Advisor

Hi,

By default, all the AEM urls are case-sensitive. I would like to know if I can disable this case-sensitive feature or add some new configuration to do this. 

Ex:

AEM resolves the below URL:

http://localhost:4502/editor.html/content/geometrixx/en/products.html

 

AEM not able to resolve the below URL (because of capital "P" in the Products):

http://localhost:4502/editor.html/content/geometrixx/en/Products.html

 

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

Please refer to this old post:

Link:-http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

//Please refer to the comments by Joerg. 

Also ,

    Link:- https://www.w3.org/TR/WD-html40-970708/htmlweb.html

    //According to W3's "HTML and URLs" they should: There may be URLs, or parts of URLs, where case doesn't matter, but identifying these may not be easy. Users should always consider that URLs are case-sensitive.

    All “insensitive”s are boldened for readability.

    Domain names are case insensitive according to RFC 4343. The rest of URL is sent to the server via the GET/PUT method. This may be case sensitive or not.

    Take this page for example, stackoverflow.com recieves GET string /questions/7996919/should-url-be-case-sensitive, sending a HTML document to your browser. Stackoverflow.com is case insensitive because     it produces the same result for /QUEStions/7996919/Should-url-be-case-sensitive.

    On the other hand, Wikipedia is case sensitive except the first character of the title. The URLs https://en.wikipedia.org/wiki/Case_sensitivity and https://en.wikipedia.org/wiki/case_sensitivity leads to the same     article, but https://en.wikipedia.org/wiki/CASE_SENSITIVITY returns 404.

 

    As Gorg stated, it is not possible directly via AEM and it is also not the Best practices.

 

    In Apache, 

    In .htaccess

    <IfModule mod_speling.c>
    CheckSpelling on
    </IfModule>
    Tested, works, if you have the mod_speling enabled.

    Or, in a serverwide httpd.conf:

    RewriteEngine On
    RewriteMap  lc int:tolower
    RewriteCond %{REQUEST_URI} [A-Z]
    RewriteRule (.*) ${lc:$1} [R=301,L]

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

7 Replies

Avatar

Community Advisor

smacdonald2008 wrote...

Also - see this topic:

https://docs.adobe.com/docs/en/aem/6-2/deploy/configuring/resource-mapping.html

 

Hi Scott,

These URLs are for URL mappings not for case-sensitiveness. 

Lets say, if you go to below URL and try to resolve "/content/geometrixx/en/products.html", it will not resolve because of capital "P".

http://localhost:4502/system/console/jcrresolver

Avatar

Community Advisor

Ratna Kumar wrote...

Hi,

Yes, I agree with Scott. As he stated you can use the resource mapping for your use case

// http://aem-cq-tutorials.blogspot.ca/2014/06/mapping-of-request-urls-in-cqaem.html

//https://docs.adobe.com/docs/en/aem/6-2/deploy/configuring/resource-mapping.html

Thanks,
Ratna Kumar.

 

Hi Ratna Kumar,

We are talking about two different things here.

I don't think resource mapping will work.

Below is the reply from one of those articles:

Problem 2: 
Say we need to implement case insensitivity in URL in our CQ application like test.html and TEST.HTML directs to same page

Anaylsis:
While trying to use Apache mod_rewrite and mod_speling we can find they both having some undesired effects on various type of requests. Option could be to create a request filter for this, but having multiple URL's for the same page is not recommended for SEO. 

Solution:
We can use mod_rewrite.c for this at your HTTP server so that CMS system remains untouched. Best known pattern approach for CQ is keep AEM content pages lowercase with no underscores and have http server convert url requests to lower case. Doing url clean up on webserver level improves your dispatcher caching options too. 

 

Ex: 

You can do the resource mapping: 

www.example.com    to /content/geometrixx/en/products.html   This will work.

 

But if you do:

www.example.com    to /content/geometrixx/en/Products.html. This will not work. Because AEM will be not able to resolve that path because of capital "P". 

 

Resource mapping redirects to a AEM url which is case-sensitive. I think we need to do some AEM level configuration to disable this.

Thanks.

Avatar

Correct answer by
Administrator

Hi 

Please refer to this old post:

Link:-http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

//Please refer to the comments by Joerg. 

Also ,

    Link:- https://www.w3.org/TR/WD-html40-970708/htmlweb.html

    //According to W3's "HTML and URLs" they should: There may be URLs, or parts of URLs, where case doesn't matter, but identifying these may not be easy. Users should always consider that URLs are case-sensitive.

    All “insensitive”s are boldened for readability.

    Domain names are case insensitive according to RFC 4343. The rest of URL is sent to the server via the GET/PUT method. This may be case sensitive or not.

    Take this page for example, stackoverflow.com recieves GET string /questions/7996919/should-url-be-case-sensitive, sending a HTML document to your browser. Stackoverflow.com is case insensitive because     it produces the same result for /QUEStions/7996919/Should-url-be-case-sensitive.

    On the other hand, Wikipedia is case sensitive except the first character of the title. The URLs https://en.wikipedia.org/wiki/Case_sensitivity and https://en.wikipedia.org/wiki/case_sensitivity leads to the same     article, but https://en.wikipedia.org/wiki/CASE_SENSITIVITY returns 404.

 

    As Gorg stated, it is not possible directly via AEM and it is also not the Best practices.

 

    In Apache, 

    In .htaccess

    <IfModule mod_speling.c>
    CheckSpelling on
    </IfModule>
    Tested, works, if you have the mod_speling enabled.

    Or, in a serverwide httpd.conf:

    RewriteEngine On
    RewriteMap  lc int:tolower
    RewriteCond %{REQUEST_URI} [A-Z]
    RewriteRule (.*) ${lc:$1} [R=301,L]

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 2

You have to ensure all is lowercase in AEM then add mod_rewrite rule to apache or to those of us using varnish it could be even implemented there. We did avoid using AEM for this job as this might affect licence costs on a long term.