Forum Moderators: phranque
I have made changes to some pages of my website, and they no longer exist, but they are ranked well in search engines. I am doing this in my htaccess file:
redirect 301 /oldfile.html http://www.example.com/newfile.html
These files are located on my root folder (public_html). The problem is that I have another domain in that hosting account (public_html/domain) and it has an oldfile.html file into it. So, it keeps redirecting to the site hosted in the root's newfile.html, whereas I wouldn't like it to redirect at all.
Could anyone help me? Thank you so much!
[edited by: jdMorgan at 12:51 pm (utc) on Oct. 27, 2008]
[edit reason] Please use example.com [/edit]
Take care to correctly handle both www- and non-www variants of the hostname -- or better yet, add another rule to redirect the non-canonical hostnames to the canonical hostnames (e.g. redirect non-www to www (or vice versa) for both of your domains).
See Apache mod_rewrite RewriteCond, RewriteRule, and RewriteEngine directives. Links to this documentation and other useful resources are cited in our Forum Charter (see link at top left of this page).
Jim