How to remove extra dots on url using .htaccess?

by elmo.conroy , in category: SEO , 4 months ago

How to remove extra dots on url using .htaccess?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

by laverna_hirthe , 4 months ago

@elmo.conroy 

To remove extra dots on a URL using .htaccess, you can use the following RewriteRule:

1
2
3
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*).{2,}
RewriteRule ^(.*)$ %1 [R=301,L]


This rule checks if there are two or more consecutive dots in the REQUEST_URI and then redirects the user to the same URL without the extra dots using a 301 redirect. This will remove the extra dots from the URL and ensure that the correct content is served.