.htaccess/301 redirect Question

2 replies
  • WEB DESIGN
  • |
I want to redirect from an html subdomain on one domain to the top level of a new domain.

I'll use an example, I want to redirect fruit.com/oranges.html

to

oranges.info

The new site is WordPress based. I put the following code into my htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^.*fruit.com/oranges.html$ [NC]
RewriteRule ^(.*)$ http://www.oranges.info/$ [L,R=301]


... with no redirect occurring.

I checked my hosting and found that I have an .htaccess file in each of my domains' folders on my hosting account. I assumed I just needed to make the change to the .htaccess file in the root directly of my hosting but it didn't change anything. I also tried putting this code in .htaccess file in the folder for my fruit.com domain and that didn't work either.

I'd really appreciate any help here as I've been trying to figured this out for awhile.
#htaccess or 301 #question #redirect
  • Profile picture of the author neojiphre
    Try clearing your cache and then reload your website to see if it works.
    {{ DiscussionBoard.errors[4874433].message }}
  • Profile picture of the author Nail Yener
    The .htaccess file should be in the folder of fruit.com domain. And here is the code that works:

    Code:
    Redirect 301 /fruit.html http://www.oranges.info/
    Remove www. if you don't use that on oranges.info domain.
    {{ DiscussionBoard.errors[4875286].message }}

Trending Topics