Hi ,
I want AEM URLs without html extension how can i achieve this?
@tatrived : I assume you need this on your websites domain url i.e www.your-site.com
Please refer:
Below is my rewrite.rules file i have added
RewriteCond %{REQUEST_URI} !\.(html|jpg|jpeg|gif|png|tif|pdf|doc|docx|xls|xlsx|ppt|pptx|swf|css|js|svg)$
But when i am accessing http://localhost:4502/editor.html/content/us/en/test/
i am getting 403 FORBIDDEN Error and even i remove the rule i can't access the url without ext
..................................
rewrite.rules
#
# This file contains the rewrite rules, and can be customized.
#
# By default, it includes just the rewrite rules. You can
# add rewrite rules to this file but you should still include
# the default rewrite rules.
Include conf.d/rewrites/default_rewrite.rules
RewriteCond %{REQUEST_URI} !\.(html|jpg|jpeg|gif|png|tif|pdf|doc|docx|xls|xlsx|ppt|pptx|swf|css|js|svg)$
RewriteCond %{REQUEST_URI} !^/apps
RewriteCond %{REQUEST_URI} !^/bin
RewriteCond %{REQUEST_URI} !^/content
RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{REQUEST_URI} !^/home
RewriteCond %{REQUEST_URI} !^/libs
RewriteCond %{REQUEST_URI} !^/system
RewriteCond %{REQUEST_URI} !^/tmp
RewriteCond %{REQUEST_URI} !^/var
RewriteCond %{REQUEST_URI} (.html|.jpe?g|.png|.svg)$
# rewrite for root redirect
RewriteRule ^/?$ /content/cisco-dcloud/us/en/home.html [PT,L]
RewriteRule ^/en/(.*)$ /content/cisco-dcloud/us/en/$1 [PT,L]
RewriteRule ^/us/en/(.*)$ /content/cisco-dcloud/us/en/$1 [PT,L]
RewriteRule ^/services/(.*)$ /content/cisco-dcloud/us/en/home/services/$1 [PT,L]
# Rewrite rules for custom error pages
ErrorDocument 404 /services/404.html
# RewriteCond %{REQUEST_URI} ^/us/.*
# RewriteCond %{HTTP:x-aem-variant} ^.*$
# RewriteRule ^([^?]+)\.(html.*)$ /content/cisco-dcloud$1.%{HTTP:x-aem-variant}.$2 [PT,L]
Hi @tatrived
To access pages without adding the `.html` extension to the URLs in AEM, you can configure the Apache Sling Resource Resolution to remove the extension. Here's how you can do it:
1. Open the AEM Web Console by navigating to `http://localhost:4502/system/console/configMgr` (replace `localhost:4502` with your AEM instance URL if necessary).
2. Search for the "Apache Sling Resource Resolver Factory" configuration and click on it to open the configuration page.
3. In the configuration page, locate the "Resource Resolver Mapping" section.
4. Add a new entry to the "URL Mappings" field. The entry should have the following format: `/content=/content.html`. This mapping tells AEM to resolve URLs without the `.html` extension.
5. Save the configuration.
After making this configuration change, you should be able to access pages without adding the `.html` extension to the URLs. For example, if you have a page with the path `/content/mysite/mypage`, you can access it using the URL `http://localhost:4502/content/mysite/mypage` instead of `http://localhost:4502/content/mysite/mypage.html`.
Please note that modifying the resource resolution configuration can have implications on the overall URL structure and may require adjustments to your website's links and references. It's recommended to thoroughly test the changes and ensure they align with your specific requirements and use cases.
If you are using AEM Dispatcher as a caching and load balancing component, you need to configure it to handle URLs without the ".html" extension.
Open the Dispatcher configuration file:
Add a URL rewrite rule:
Save the configuration.
After making these changes, ensure that links in your AEM components do not include the ".html" extension. AEM will automatically resolve URLs based on the configuration changes.
If you are using the AEM Dispatcher, clear the cache to ensure that the new configuration takes effect.
Add a new entry to the "URL Mappings" field. in Sling Resource Resolver Factory giving error in all URL "
I am new to AEM can someone guide me step by step?
Follow below link
https://medium.com/@toimrank/aem-dispatcher-part-0-a2dcd4771538
Views
Replies
Total Likes