You could try:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.sitename\.it [NC]
RewriteRule ^(.*)$ http://sitename.it/$1 [L,R=301]
Added [NC] flag to the RewriteCond directive: This makes the hostname comparison case-insensitive, ensuring that it matches both "www.sitename.it" and "Sitename.it", for example.
Escaped the dots in the domain name: In regular expressions, dots have a special meaning, so they need to be escaped to match literal dots in the domain name.
Added ^ and $ anchors in the RewriteRule pattern: This ensures that the rule only matches requests for the root of the domain (e.g., "www.sitename.it/") and not subdirectories. This helps prevent unintended redirection loops.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.sitename\.it [NC]
RewriteRule ^(.*)$ http://sitename.it/$1 [L,R=301]
Added [NC] flag to the RewriteCond directive: This makes the hostname comparison case-insensitive, ensuring that it matches both "www.sitename.it" and "Sitename.it", for example.
Escaped the dots in the domain name: In regular expressions, dots have a special meaning, so they need to be escaped to match literal dots in the domain name.
Added ^ and $ anchors in the RewriteRule pattern: This ensures that the rule only matches requests for the root of the domain (e.g., "www.sitename.it/") and not subdirectories. This helps prevent unintended redirection loops.
Statistics: Posted by CityPop — Tue Mar 19, 2024 2:58 pm