Home > Programming > Htaccess File Help

Htaccess File Help

February 9th, 2010

I am running a WordPress site that was converted over from a static html site. I have an htaccess file in place to 1) rewrite posts (per WordPress), 2) redirect old pages to new pages.

My problem is that everything works fine except for simply redirecting www.example.com/index.html to www.example.com/

Here is what my htaccess file looks like:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#
RewriteRule ^index.html$ http://www.example.com/ [R,L] – This is the one that does not work
RewriteRule ^aboutus.html$ http://www.example.com/about-my-company/ [R,L]
RewriteRule ^testimonials.html$ http://www.example.com/ [R,L]
RewriteRule ^portfolio.html$ http://www.example.com/company-portfolio/ [R,L]
RewriteRule ^services.html$ http://www.example.com/what-we-offer/ [R,L]
RewriteRule ^contact.html$ http://www.example.com/contact-us/ [R,L]

The entire thing can be rewritten. Here are my goals:

1) WordPress functionality for SEO links (which works now)
2) Pages that are old (like contact.html) are still in the search engine results. I want those redirected (or rewritten?) to the new url path. Those html files should not have to actually exist on the server.
3) definitely need http://www.example.com/index.html to redirect to http://www.example.com


Htaccess File Help

Comments are closed.
Bear