Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

.htaccess 301 problem both sites on same hosting



3:14 pm on Feb 8, 2010 (gmt 0)

10+ Year Member

I've tried searching the forum for an answer, but have not had any luck.

I need to redirect all pages of an old site to the new site. The 2 sites have a different file structure, so I need all the hold pages to redirect to the homepage of the new site. Both sites are on the same hosting plan.

This is my .htaccess file, I've got it on the old site:

RewriteEngine On
RedirectMatch 301 ^.+$ http://new-example.com/

The problem is that when redirecting from inner pages of the old site, the user gets sent to non-existant pages in the new site, like to from www.old-example.com/site/article.asp?AID=16 to newexample.com/?AID=16

I've tried various commands in the .htaccess but can't solve the problem, since I do not really know regular expressions, and I keep on fumbling it.

Any help would be greatly appreciated.

[edited by: jdMorgan at 4:28 pm (utc) on Feb 8, 2010]
[edit reason] examplified [/edit]


4:32 pm on Feb 8, 2010 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

RedirectMatch is a mod_alias directive, so the "RewriteEngine On" directive does nothing here.

However, I believe that the function that you need to clear the query string may require the use of mod_rewrite, so let's replace the RedirectMatch instead of removing the RewriteEngine directive:

RewriteEngine on
RewriteRule ^.*$ http://new-example.co[b]m/?[/b] [R=301,L]



6:19 pm on Feb 8, 2010 (gmt 0)

10+ Year Member

JD, thanks very much for that, this is the second time you've helped me out with .htaccess redirects and I can't thank you enough.

Featured Threads

Hot Threads This Week

Hot Threads This Month