How to make a website work without a www prefix in its name?

Usually I delete www when I enter the URL. Honestly, one important site that I visit does not support such a short URL, and I want to ask them to fix it.

Is the solution a fix for the configuration file? Or does this require a special service associated with the provider?

+4
source share
3 answers

If they have Rewrite Engine enabled, they can create a .htaccess file with this rule

 RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule (.*) http://www.example.com/$1 [L,R=301] 

Thus, everyone who comes to http://example.com is redirected to http://www.example.com automatically.

+6
source

This is the virtual host configuration or DNS C name, depending on how they are configured.

Suggest that they create a C NAME for the non-www version of their URL.

+5
source

If they have access to the VirtualHost container, they can simply add the ServerAlias โ€‹โ€‹directive:

 ServerAlias example.com 

This does not require redirection, so the user will be faster.

+2
source

Source: https://habr.com/ru/post/1339845/


All Articles