Redirect domain without www to domain with www using .htaccess 301 direct

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Here is the solution for many of you maybe searching for:

Add the following lines to .htaccess file (create a new one if it doesn’t exist).

Note: its for Linux apache environment. Change the domain url as yours.


RewriteEngine on
RewriteCond %{HTTP_HOST} ^leonli\.co.uk$ [NC]
RewriteRule ^.*$ http://www.leonli.co.uk/$0 [NC,L,R=301]

Read More

Use .htaccess to refuse/restrict specific domains to access certain folders

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.


options +FollowSymLinks -MultiViews
RewriteEngine on
# If the request is for www.example.com ...
RewriteCond %{HTTP_HOST} ^www\.leonli\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^cloudpapa\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.cloudpapa\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^leonli\.com$ [NC]
# ... and the URL starts with files/images, deny access ([F] = Forbidden)
RewriteRule .? - [F]

Place it under the target folder.

Read More