Tuesday, 2 July 2019

Remove .html extension at dispatcher

Add below dispatcher configurations in 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]

No comments :

Post a Comment