We help IT Professionals succeed at work.
Get Started

Best way to understand Apache Rewrite Implications

Last Modified: 2015-08-20
Hi -

A client has the following rewrite code in his .htaccess file:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Open in new window

I would like to :
a) translate each line into an understanding of what the code does (ie. last line means something like "wildcard redirect all links to this domain to the home page", and I think the first line is about forcing www to be in the domain name.  );

b) understand the options to change it should we judge it to be not the best rewrite for SEO.  Here, I am wondering if someone can point us at a good reference for those that don't write apache code often.

Final question:  what if the domain is going to https -- must that be described in this code?

Thanks -
Watch Question
Marketing Technologist
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE