Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Ok, so I'm in need a simple redirect:

Redirect 301 / http://www.new.com/

Similar to that, except I want it to catch anything, such as:

www.old.com/blah/blah/?xyz=123&aaaaabbbb=erewr3ttt#ewtjhirhjerh

and send the user to:

www.new.com

Should be easy right? Finding out how to do this is not so easy. Using the above rule we're still getting 404's for things that aren't there rather than the Redirect rule just getting everything.

share|improve this question
    
Ever thought of mod_rewrite? –  mailq Dec 1 '11 at 1:05
    
possible duplicate of Htaccess Redirect –  mailq Dec 1 '11 at 1:06
1  
Skip the .htaccess and put it directly into your server configuration. You may already have rewrite enabled or something. Remove that from your configuration. –  Zoredache Dec 1 '11 at 1:07

2 Answers 2

up vote 5 down vote accepted

Alternatively, you can use the RedirectMatch directive instead of using mod_rewrite:

RedirectMatch 301 ^ http://www.new.com/

Note the ^ can be interchanged with .*, both regular expressions with match everything.

share|improve this answer

This should work:-

RewriteRule (.*) http://www.new.com/ [R=301,L]

The (.*) will match everything, and redirect to just http://www.new.com/.

Edit: This was for Apache, I've retagged the question as being for Zeus.

share|improve this answer
    
Turns out it was Zeus Webserver so that didn't work (or rewriteengine doesn't exist/work on zeus..who knows.) :/ Nevermind. –  John Hunt Dec 1 '11 at 1:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.