Hello,

I require the following redirection applying 301 redirection:

Redirected from: http://www.hostingwebsitedomain.com

Redirected to: http://hostingwebsitedomain.com

Kindly assist me how it can be accompalished for all pages.

Thanks in advance!

Do you control the DNS?

Unfortuantely, DNS cannot perform an actual redirect.

Kindly assist me how it can be accompalished for all pages.

You need server side scripting, or the rediret can be done at the web server level as well (two websites, one site dedicated for the redirect to the other, not a great solution). Are you running the site with server side (php, asp.net, jsp, etc..) code?

The best and easiest solution is to add a redirection instruction to your .htaccess file:

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

Try inserting the following code in your <head> </head> tag:

<meta http-equiv="refresh" content="0; url=http://www.example.com/">

"content" specifies how many seconds elapse before you are forwarded

redirection instruction to your .htaccess file:

... assuming that there is php here..

<meta http-equiv="refresh" content="0; url=http://www.example.com/">

that would work if there were actually two web sites. oh and you'd have to do that for every page.

If the only thing you try to achieve, is to have the www writing of your url to redirect to the non www versiin (aka canonicalizstion of your domain url) then the easiest way is to do it is through the plesk, cpanel etc by setting the desired version in the domain settings. Provided,of course that you have such access.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.