URL redirection using .htaccess

Step 1 :Search for .htaccess file on the server.(Cpanel)

Step 2: Check hidden files (under settings) to show all hidden files.

Step 3: If No .htaccess found,

  • Create a htaccess.txt file in local machine (without “.” – as this may prevent upload using cpanel) ,
  • Upload using cpanel, and
  • then rename htaccess.txt to .htaccess

Step 4: Copy the following text to direct all calls from

from phoenixtravelsautralia.com.au ==>>  www.phoenixtravelsaustralia.com.au
#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^phoenixtravelaustralia.com.au [NC]
RewriteRule ^(.*)$ http://www.phoenixtravelaustralia.com.au/$1 [L,R=301,NC]

 

OR do the following

Step 5:

# If your site can be accessed both with and without the ‘www.’ prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the ‘www.’ prefix. Choose ONLY one option:

# To redirect all users to access the site WITH the ‘www.’ prefix,
# (http://example.com/foo will be redirected to http://www.example.com/foo)
# uncomment the following:
RewriteCond %{HTTP_HOST} .

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

 

helping link:

http://www.inmotionhosting.com/support/website/htaccess/force-www-htaccess

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s