psihodelia
psihodelia

Reputation: 30492

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

Normally, I drop www when typing in the URL. Frankly, one important site I visit, don't support such shorted URL and I want to ask them to fix it.

Is a solution a configfile fix? Or does it require a special provider-related service?

Upvotes: 4

Views: 3572

Answers (3)

Clodoaldo Neto
Clodoaldo Neto

Reputation: 125244

If they have access to the VirtualHost container then they can just add the ServerAlias directive:

ServerAlias example.com

This will require no redirection so it will be faster to the user.

Upvotes: 2

mike
mike

Reputation: 5213

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

RewriteEngine on

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

This way everyone who comes to http://example.com is redirected to http://www.example.com automatically.

Upvotes: 6

John Lewis
John Lewis

Reputation: 722

It's a virtual host configuration or a DNS C name, depending on how they have it configured.

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

Upvotes: 5

Related Questions