Gaurav
Gaurav

Reputation: 31

How to add www to my domain and subdomain url

I want to add www to my all sub domain urls.

For example I want to convert url https://sub.mydomain.com to https://www.sub.mydomain.com. Is this possible with htaccess ?

Currently I get an error when I add www before the sub domain

Error: Requested page cannot be loaded. 
Details: locale/www/labels.php not found.

Upvotes: 2

Views: 416

Answers (1)

Ilya
Ilya

Reputation: 4689

If you have Rewrite_Engine (mod_rewrite) on your server, you can use it following way for redirecting of all visitors from URL without "www." to URL with "www." (you can add these lines in the .htaccess):

RewriteEngine on
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

But first of all you need to fix this error message (i.e. support showing of right pages on URLs with "www."). To do it you need to configre your server properly. But we don't know anything about configuration of your server, so can't help you. Please extend your question.

Upvotes: 1

Related Questions