homepage Welcome to WebmasterWorld Guest from 54.243.13.30
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
.htaccess 301 problem both sites on same hosting
spiral




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

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]

 

jdMorgan




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

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]

Jim

spiral




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved