Forum Moderators: phranque

Message Too Old, No Replies

problem with .htaccess

         

SlowMove

9:57 pm on Mar 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to direct every page on an old site to a specific page on a new site. I'm using a simple .htaccess 301 redirect:


redirect 301 / h**p://www.newsite.com/dir/page.html

It works well if I type h**p://www.oldsite.com,
but if I enter h**p://www.oldsite.com/foo/bar.html,
I'm directed to h**p://www.newsite.com/dir/page.htmlfoo/bar.html.
The redirect is appending everything after the old domain which isn't what I'm trying to do. Any help would be appreciated.

SlowMove

10:38 pm on Mar 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have no idea what I'm doing, but the following did the trick:


RewriteEngine On

RewriteRule ^(.*)$ h**p://www.newsite.com/dir/page.html [R=301,L]

jdMorgan

4:39 am on Mar 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could also use the RedirectMatch [httpd.apache.org] directive to accomplish the same thing in a more familiar way, if you like.

Jim