Hi, everyone!
I'll put a little bit in situation, we have a project under the path /content/espacio-comunicaciones, let's put as an example a page of this project that is hosted in AEM in /content/espacio-comunicaciones/es/home. On this project, we have already implemented that if a user accesses in his browser to https://<domain>/es/home.html, it redirects internally to the path of /content/espacio-comunicaciones/es/home mentioned before, invisible redirection for the user but showing the page correctly. Now, if the user instead of using that path, searches for https://<domain>/content/espacio-comunicaciones/es/home.html, the page is also displayed in the browser.
This last case is the one we have been asked to change, they want that if a user tries to access the page using the /content path, it is blocked and gives an error.
I have tried some things in dispatcher but none of them has helped me:
1. Blocking the searches with path /content/espacio-comunicaciones and returning a 404 in that case, the problem with this way is that, although the pages searched with /content are blocked and the ones searched without the /content are shown, the queries that try to access /content stop working and therefore, the components that use them give error in the pages. The code I used for this case, in the .rules for that project, was the following:
RewriteCond %{REQUEST_URI} ^/(content/espacio-comunicaciones) [NC]
RewriteRule ^ - [R=404,L]
2. The next two tests I did were similar to each other, I just changed /path to /url in the line below. In the filters for that project I added a deny to block the /content/espacio-comunicaciones path, the problem is that this blocking seems to be done after internally AEM has converted the searched path by the internal one, since when searching for pages with https://<domain>/es/home.html (without entering the path with the /content) they are also blocked. I didn't know if /url and /path had any difference in that but it seems not, with both the same thing happens. Then I read in the forum that with /url you don't have to put the /extension but honestly, even if I remove that, I don't think it will work for what I'm looking for (since it also blocked everything). This is the line of code (also with /url instead of /path):
/deny_content_url { /type "deny" /extension '(html)' /path "/content/espacio-comunicaciones/*" }
Do you know of a way to block the pages searched directly with path /content, but without blocking the pages searched by domain and without stopping the queries and internal calls to /content that AEM makes?
Thanks in advance,
Paula
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Sure! But it didn't work for me, it didn't redirect. We managed to find a rule that does make the redirection as I was looking for, I leave it here and mark the solution in case it helps someone else:
RewriteRule ^/content/espacio-comunicaciones/es/?(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
Anyway, thanks because your answer helped us to refine the solution.
Best regards,
Paula
Views
Replies
Total Likes
Hi @PaulaMrtnez
Instead of blocking, you may redirect user to correct path
Example - Write below rule as first redirect rule
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/content/espacio-comunicaciones/(.*)\.html$ [NC]
RewriteRule ^content/espacio-comunicaciones/(.*)\.html$ /$1.html [R=301,L]
Otherwise you can try below 404 rule
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/content/espacio-comunicaciones/.*\.html$ [NC]
RewriteRule .* - [R=404,L]
Dispatcher filter will not help here
Hello, @arunpatidar, thank you for your reply.
I have tried with both changes and it doesn't seem to make me the redirection, the route stays the same, which is a bit strange.... I have therefore decided to check the dispatcher logs to see if I can find out what might be happening.
The page searched with /content shows fine, no redirects or crashes, queries seem to work, these are the logs shown after that search:
[Fri Mar 28 12:15:50 2025] [I] [pid 836749:tid 139621698393856] "GET /content/espacio-comunicaciones/es/sma.888.html?Test" 200 none [espaciosfarm/0] 467ms
[Fri Mar 28 12:15:50 2025] [I] [pid 836749:tid 139621698393856] "GET /libs/granite/csrf/token.json" 304 none [espaciosfarm/0] 15ms
When I search for the path without /content, certain pages give error and are not displayed properly. This is what appears in the dispatcher log after searching for the path without /content:
[Fri Mar 28 12:41:01 2025] [I] [pid 359794:tid 140326463313664] "GET /content/espacio-comunicaciones/es/sma.nmc.270.html" - hit [espaciosfarm/-] 0ms
[Fri Mar 28 12:41:01 2025] [I] [pid 359793:tid 140326513669888] "GET /etc.clientlibs/catalog/clientlibs/clientlib-components/clientlib-blockContent.min.ACSHASHe57fccc75e37df3be74a73af4c0a619d.css" - miss [espaciosfarm/0] 38ms
[Fri Mar 28 12:41:01 2025] [I] [pid 359792:tid 140326236776192] "GET /etc.clientlibs/espacio-comunicaciones/clientlibs/clientlib-dependencies.min.ACSHASHd41d8cd98f00b204e9800998ecf8427e.css" - miss [espaciosfarm/0] 50ms
[Fri Mar 28 12:41:02 2025] [I] [pid 359885:tid 140326463313664] "GET /etc.clientlibs/catalog/clientlibs/clientlib-components/clientlib-section.min.ACSHASHcffebb0e2cbee7919d853b1e7ee0f174.css" - miss [espaciosfarm/0] 10ms
[Fri Mar 28 12:41:02 2025] [I] [pid 359794:tid 140326463313664] "GET /etc.clientlibs/espacio-comunicaciones/clientlibs/clientlib-base.min.ACSHASHe689f931d9a79b4e3f3c7ed39b685b68.css" - miss [espaciosfarm/0] 87ms
[Fri Mar 28 12:41:02 2025] [I] [pid 359792:tid 140326236776192] "GET /etc.clientlibs/clientlibs/granite/jquery/granite.min.ACSHASHed0d934d509c9dab702088c125c92b4f.js" - miss [espaciosfarm/0] 9ms
[Fri Mar 28 12:41:02 2025] [W] [pid 359792:tid 140326236776192] Unable to fetch vanity URLs from 10.45.2.7:4503/libs/granite/dispatcher/content/vanityUrls.html: remote server returned: HTTP/1.1 404 Not Found
[Fri Mar 28 12:41:02 2025] [I] [pid 359792:tid 140326236776192] "GET /etc/cloudsettings.kernel.js/libs/settings/cloudsettings/legacy/contexthub" - blocked [espaciosfarm/-] 8ms
[Fri Mar 28 12:41:02 2025] [I] [pid 359794:tid 140326463313664] "GET /etc.clientlibs/foundation/clientlibs/shared.min.ACSHASHe9d9a3990d7779c2e8e3361187f3d36b.js" - miss [espaciosfarm/0] 16ms
[Fri Mar 28 12:41:02 2025] [I] [pid 359793:tid 140326513669888] "GET /etc.clientlibs/espacio-comunicaciones/clientlibs/clientlib-components/clientlib-breadcrumb.min.ACSHASH6a901789885a7d16d1dc47a6b6e95a12.js" - miss [espaciosfarm/0] 20ms
[Fri Mar 28 12:41:02 2025] [I] [pid 359794:tid 140326463313664] "GET /etc.clientlibs/espacio-comunicaciones/clientlibs/clientlib-site.min.ACSHASH048bd59c89c4f28611ad73cf53635c58.js" - miss [espaciosfarm/0] 15ms
[Fri Mar 28 12:41:02 2025] [I] [pid 359792:tid 140326236776192] "GET /content/espacio-comunicaciones/es/errors/404.html" - miss [espaciosfarm/0] 294ms
[Fri Mar 28 12:41:02 2025] [I] [pid 359793:tid 140326513669888] "GET /etc.clientlibs/espacio-comunicaciones/clientlibs/clientlib-base.min.ACSHASH6ad1352824750946f721fe8604bbea1f.js" - miss [espaciosfarm/0] 248ms
[Fri Mar 28 12:41:02 2025] [I] [pid 359794:tid 140326463313664] "GET /etc.clientlibs/catalog/clientlibs/clientlib-site/resources/fonts/Repsol/SoleRepsolText_W_SBd.woff" - hit [espaciosfarm/-] 1ms
[Fri Mar 28 12:41:02 2025] [I] [pid 359792:tid 140326236776192] "GET /etc.clientlibs/catalog/clientlibs/clientlib-site/resources/icon/icomoon.ttf?heauzz" 200 none [espaciosfarm/0] 13ms
[Fri Mar 28 12:41:15 2025] [I] [pid 359794:tid 140326379452160] "GET /content/dam/espacio-comunicaciones/imagenes/pictogramas/EESS.svg" - miss [espaciosfarm/0] 14ms
[Fri Mar 28 12:41:15 2025] [I] [pid 359792:tid 140326480099072] "GET /content/dam/espacio-comunicaciones/imagenes/pictogramas/BIBLIO_DIGITAL.svg" - miss [espaciosfarm/0] 66ms
[Fri Mar 28 12:41:15 2025] [I] [pid 359792:tid 140326480099072] "GET /content/dam/espacio-comunicaciones/imagenes/pictogramas/PRESENTACION.svg" - miss [espaciosfarm/0] 11ms
[Fri Mar 28 12:41:15 2025] [I] [pid 359793:tid 140326480099072] "GET /content/dam/espacio-comunicaciones/imagenes/pictogramas/CASCO.svg" - miss [espaciosfarm/0] 16ms
[Fri Mar 28 12:39:22 2025] [E] [pid 836749:tid 139621576984320] Unable to create parent directory /mnt/var/www/html/content/espacio-comunicaciones/es: Permission denied
[Fri Mar 28 12:39:22 2025] [I] [pid 836749:tid 139621576984320] "GET /content/espacio-comunicaciones/es/sma.nmc.270.html" 200 miss [espaciosfarm/0] 366ms
[Fri Mar 28 12:41:01 2025] [I] [pid 836748:tid 139621459486464] "GET /etc.clientlibs/clientlibs/granite/jquery.min.ACSHASH1fc733054ddb2e2fcd4a0f763671047b.js" - miss [espaciosfarm/0] 32ms
[Fri Mar 28 12:41:01 2025] [I] [pid 836748:tid 139621459486464] "GET /etc.clientlibs/espacio-comunicaciones/clientlibs/clientlib-site.min.ACSHASHd41d8cd98f00b204e9800998ecf8427e.css" - miss [espaciosfarm/0] 15ms
[Fri Mar 28 12:41:01 2025] [I] [pid 836750:tid 139621535020800] "GET /etc.clientlibs/espacio-comunicaciones/clientlibs/clientlib-components/clientlib-breadcrumb.min.ACSHASHb66b3ba8516fe313f3d6759fea332183.css" - miss [espaciosfarm/0] 15ms
[Fri Mar 28 12:41:02 2025] [I] [pid 836750:tid 139621535020800] "GET /etc.clientlibs/catalog/clientlibs/clientlib-components/clientlib-documents.min.ACSHASH92183bd21500e88026b6f9acee56b985.css" - miss [espaciosfarm/0] 16ms
[Fri Mar 28 12:41:02 2025] [I] [pid 836750:tid 139621535020800] "GET /etc.clientlibs/clientlibs/granite/utils.min.ACSHASH15b6fc27cccbddb5fb7b88a7c6a2c7e4.js" - miss [espaciosfarm/0] 15ms
[Fri Mar 28 12:41:02 2025] [I] [pid 836748:tid 139621459486464] "GET /etc.clientlibs/foundation/clientlibs/jquery.min.ACSHASHdd9b395c741ce2784096e26619e14910.js" - miss [espaciosfarm/0] 10ms
[Fri Mar 28 12:41:02 2025] [I] [pid 836750:tid 139621535020800] "GET /etc.clientlibs/espacio-comunicaciones/clientlibs/clientlib-dependencies.min.ACSHASHd41d8cd98f00b204e9800998ecf8427e.js" - miss [espaciosfarm/0] 15ms
[Fri Mar 28 12:41:02 2025] [I] [pid 836748:tid 139621459486464] "GET /etc.clientlibs/catalog/clientlibs/clientlib-components/clientlib-richtext-analytic.min.ACSHASH64f598fbfb106f95cac22a214a00601e.js" - miss [espaciosfarm/0] 16ms
[Fri Mar 28 12:41:02 2025] [I] [pid 836750:tid 139621535020800] "GET /etc.clientlibs/core/wcm/components/commons/site/clientlibs/container.min.ACSHASH027d01df25f17066242db969c9bf2ade.js" - miss [espaciosfarm/0] 12ms
[Fri Mar 28 12:41:02 2025] [I] [pid 836748:tid 139621459486464] "GET /libs/granite/csrf/token.json" 200 none [espaciosfarm/0] 88ms
[Fri Mar 28 12:41:02 2025] [I] [pid 836750:tid 139621535020800] "GET /etc.clientlibs/catalog/clientlibs/clientlib-site/resources/fonts/Repsol/SoleRepsolDisplay_W_Rg.woff" - hit [espaciosfarm/-] 0ms
[Fri Mar 28 12:41:02 2025] [I] [pid 836750:tid 139621535020800] "GET /etc.clientlibs/espacio-comunicaciones/clientlibs/adobe-client-data-layer.min.js.map" 404 none [espaciosfarm/0] 10ms
[Fri Mar 28 12:41:02 2025] [E] [pid 836750:tid 139621535020800] Unable to create parent directory /mnt/var/www/html/content/espacio-comunicaciones/es/errors: Permission denied
[Fri Mar 28 12:41:02 2025] [I] [pid 836750:tid 139621535020800] "GET /content/espacio-comunicaciones/es/errors/404.html" 200 miss [espaciosfarm/0] 114ms
[Fri Mar 28 12:41:15 2025] [E] [pid 836749:tid 139621509842688] Unable to create parent directory /mnt/var/www/html/content/dam/espacio-comunicaciones/imagenes/pictogramas: Permission denied
[Fri Mar 28 12:41:15 2025] [I] [pid 836749:tid 139621509842688] "GET /content/dam/espacio-comunicaciones/imagenes/pictogramas/CISTERNA.svg" 200 miss [espaciosfarm/0] 12ms
[Fri Mar 28 12:41:15 2025] [E] [pid 837220:tid 139621056898816] Unable to create parent directory /mnt/var/www/html/content/dam/espacio-comunicaciones/imagenes/pictogramas: Permission denied
[Fri Mar 28 12:41:15 2025] [I] [pid 837220:tid 139621056898816] "GET /content/dam/espacio-comunicaciones/imagenes/pictogramas/ALERTA.svg" 200 miss [espaciosfarm/0] 14ms
[Fri Mar 28 12:41:15 2025] [E] [pid 836748:tid 139621451093760] Unable to create parent directory /mnt/var/www/html/content/dam/espacio-comunicaciones/imagenes/pictogramas: Permission denied
[Fri Mar 28 12:41:15 2025] [I] [pid 836748:tid 139621451093760] "GET /content/dam/espacio-comunicaciones/imagenes/pictogramas/GUANTES.svg" 200 miss [espaciosfarm/0] 10ms
[Fri Mar 28 12:41:15 2025] [E] [pid 837220:tid 139621056898816] Unable to create parent directory /mnt/var/www/html/content/dam/espacio-comunicaciones/imagenes/pictogramas: Permission denied
[Fri Mar 28 12:41:15 2025] [I] [pid 837220:tid 139621056898816] "GET /content/dam/espacio-comunicaciones/imagenes/pictogramas/GELDESINFECTANTE.svg" 200 miss [espaciosfarm/0] 13ms
Anyway thanks for the suggestion! I will continue testing and reviewing logs, It may be blocked somewhere else.
Regards,
Paula
Views
Replies
Total Likes
Hi @PaulaMrtnez
I have tested the redirect rule here, works for me, however the syntyx are .htaccess
Sure! But it didn't work for me, it didn't redirect. We managed to find a rule that does make the redirection as I was looking for, I leave it here and mark the solution in case it helps someone else:
RewriteRule ^/content/espacio-comunicaciones/es/?(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
Anyway, thanks because your answer helped us to refine the solution.
Best regards,
Paula
Views
Replies
Total Likes
The error message "Unable to create parent directory ... Permission denied" indicates that the dispatcher does not have the necessary permissions to create the specified directory.
Here are the steps to resolve this issue:
If SELinux is enabled on your system, it may prevent the Dispatcher process from writing to the directory.
Check SELinux status:
sestatus
Temporarily disable SELinux to test if it is causing the issue:
sudo setenforce 0
If disabling SELinux resolves the issue, adjust the SELinux context for the directory:
sudo chcon -R -t httpd_sys_rw_content_t /mnt/var/www/html
After fixing ownership and permissions, restart the Dispatcher service to apply the changes.
sudo systemctl restart httpd
Views
Likes
Replies