For website SEO purpose must be open from www subdomain, Your website can access www subdomain and you have to redirect to www domain if not open without www subdomain.
Follow the steps
– make sure rewrite_module on
Automatically website open from www subdomain by .htaccess
1 2 3 4 5 6 7 8 |
#Redirect Www Sub Domain RewriteEngine on RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] |
For WordPress website
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress |
More Stories
How to set EC2 Ubuntu default password
CPU & Memory usage in PHP
Install PHP mcrypt extension on Ubuntu