Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm in a situation and haven't been able to find a proper solution after much research. I'm working with a client who just built a new website with a different URL structure. After the website was complete, I began to tackle any canonicalization issues for proper SEO and site organization. I was able to solve the www vs non-www version of the site being displayed using .htaccess, which made me feel I would be able to 301 all of the old URLs to their corresponding new URLs. I was wrong. I haven't been able to get a single 301 redirect to perform through .htaccess. Instead, I get a 404 page with little clues that reveal my client may be on an IIS server, which I think is a little strange because the .htaccess is working(somewhat).

I'm hoping that it's just the syntax of my .htaccess file to solve www vs non-www that's stopping all other 301 redirects from being completed. Here is what the current .htaccess file looks like.

 RewriteEngine On
 RewriteBase /
 Options +FollowSymLinks
 RewriteCond %{THE_REQUEST} ^.*/index.php
 RewriteRule ^(.*)index.php$ http://www.example.com/$1 [R=301,L]
 RewriteCond %{HTTP_HOST} ^example.com [NC]
 RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

Is there anything I've unintentionally added above that would interfere with doing a 301 redirect for other URLs? Such as:

 Redirect 301 /old.htm http://www.example.com/products/side-by-side.htm

Within some of the new product directories exists .htaccess files that are rewriting PHP URLs into cleaner, user friendly URLs. Could this have an effect?

share|improve this question
Before continuing to fiddle with this why are you not addressing the "IIS or not" question first? Apparently there are ways of getting htaccess supported under IIS(I never work on it), if that's even what's going on, but even so there may be quirks. You need to know what you're actually working with. –  Su' Aug 20 '12 at 17:00
Unfortunately, the client outsourced the development of the website. The first thing I did when I noticed hints of an IIS server was contact the client to have their development team remedy the situation(I, too, do not work with IIS). However, they do not understand what is trying to be accomplished as they sent me back the most ridiculous .htaccess file that made matters worse. I'll attempt to gather more information. Thank you. –  Cody Sharp Aug 20 '12 at 17:49
It is an IIS server using .htaccess and PHP. –  Cody Sharp Aug 22 '12 at 15:08
add comment

1 Answer

up vote 1 down vote accepted

I ended up solving the problem. The below syntax does not work:

 Redirect 301 /old.htm http://www.example.com/category/new.htm

However, this syntax works:

 RewriteRule old.htm /products/new.htm [R=301,L]

I'm not really sure why the first example doesn't work, but the second works. Perhaps, it's because the .htaccess is on an IIS server and only understands certain syntax structures for redirects. I feel it's also important to note that the beginning of the old URL for the working redirect does not start with a slash, this may be due to the "RewriteBase /" line in the file.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.