April 26, 2020
Estimated Post Reading Time ~

Remove .html extension at dispatcher

Add below dispatcher configurations in the dispatcher.any file to remove .html extension from the URL.

#Enable RewriteEngine
RewriteEngine on

#Map the root folder to the home page
RewriteRule ^/?$ /content/we-retail/us/en/home.html [PT,L]

# remove any trailing slash, if it's there.
RewriteRule ^(.+)/$ $1

#Remove .html Extension
RewriteRule ^(.*).html$ $1 [R,L]

#Shorten the URL
RewriteRule ^/content/we-retail/us/(.*)$ $1 [R,L]

#Remove .html and map products url
RewriteRule ^/en/products.html/(.*)$ /en/products/$1 [R,L]

RewriteCond %{REQUEST_URI} !^/(apps|content|etc|home|libs|system|tmp|var|services)

RewriteRule ^/en/products/(.*)$ /content/we-retail/us/en/products.html/$1 [PT,L]

RewriteCond %{REQUEST_URI} !^/(apps|content|etc|home|libs|system|tmp|var|services)

RewriteRule ^/(.*)$ /content/we-retail/us/$1.html [PT,L]


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.