I'm in need of some htaccess syntax. I recently migrated a drupal 6 site to a drupal 7 site. The original site was located in a subdirectory, foo.foobar.com I now have several hundred links in such places as Facebook etc linking to this domain. I have an htaccess file in the subdirectory of the new site, /public_*html/foo, that redirects simple requests but it does not work for individual node requests. They return 404 errors. This subdirectory is otherwise empty.

What is the correct syntax to accomplish a rewrite of foo.foobar.com/some/additional/pathing TO foobar.com/some/additonal/pathing
given that there are several hundreds of these additional paths. I'd rather not map the old site and write a redirect for each possibility.

I have tried such things as:
RedirectMatch 301 ^foo/.*$ http://foobar.com/

I see alot of stuff for redirecting to a subdirectory but not from a subdirectory to the root directory. Actually, in this particular case I'm going from a subdirecotry to an addon directory but that shouldn't complicate it any more than it already is.

Recommended Answers

All 2 Replies

Nevermind, I found something that works. I'm very rusty on Apache.

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.new-domain.com/$1 [R=301,L]

If you run into any other issues with this, just let us know.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.