301 redirect

Trying to implement a 301 redirect and am told by the site below that it isn't working:


I have tried (trying to redirect acesestimating.com to www.acesestimating.com):

rewritecond %{http_host} ^acesestimating.com [nc]
rewriterule ^(.*)$ http://www.acesestimating.com/$1 [r=301,nc]

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

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

Sheldon LivingstonConsultantAsked:
Who is Participating?
Sheldon LivingstonConsultantAuthor Commented:
I think we can delete this question...  I am moving the site from an IIS (MS) server to an Apache server and will use the .htaccess file.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^acesestimating.com
RewriteRule (.*) http://www.acesestimating.com/$1 [R=301,L]

Open in new window

Sheldon LivingstonConsultantAuthor Commented:
Ok... turns out that 1and1 hosts their php pages on IIS... which, I think, explains why Gary's answer won't work.

The code below is supposed to work within the web.config file:

        <rule name="Redirect to WWW" stopProcessing="true">
          <match url=".*" />
            <add input="{HTTP_HOST}" pattern="^acesestimating.com$" />
          <action type="Redirect" url="http://www.acesestimating.com"
               redirectType="Permanent" />

This crashes the site altogether when I attempt to add this bit of code to the existing web.config file.  The existing file only contains a default document (index.php) section.

Any other thoughts?
Sheldon LivingstonConsultantAuthor Commented:
I have given up on the MS IIS server and am moving to Apache.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.