I have a url on my site www.example.com/ebook/ that has a lot of incoming links. I've switched to drupal and want to 301 redirect that link to just www.example.com. I've modified my .htaccess file but it's still not redirecting. I've changed this part of the .htaccess file from this:

# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,

to this:

# RewriteBase /drupal
#
RewriteRule ^/ebook/ http://www.example.com [R=301,L]
# If your site is running in a VirtualDocumentRoot at http://example.com/,

I have tried it with "/ebook/" and "/ebook" and "/ebook/index.html". I've tried deleting the "/ebook/index.html" file and folder from the server.

Any ideas what I am doing wrong? Thanks!

Comments

briansea’s picture

The following should do what you want:

 RewriteEngine on
RewriteCond %{REQUEST_URI} ^/ebook [NC]
RewriteRule .* http://www.example.com [R=301,L]

alexdim’s picture

Perfect. Thanks Brian.