13

I would like to redirect/rewrite this two kinds of URLs:

  • mydomain.com -> newdomain.com
  • mydomain.com/specificPage -> newdomain.com/newSpecificPage
  • mydomain.com/anyOtherPage -> mydomain.com/anyOtherPage (no redirect here)

So I just want to redirect the root domain to a new domain, and some pages from my domain to some pages on a new domain...

How can I do that on a JBoss server ?

Syl
  • 131
  • 1
  • 2
  • 4

4 Answers4

11

Have you looked into http://www.jboss.org/jbossweb/modules/rewrite.html? It looks like what you're looking for, and it's pretty similar to Mod_rewrite for Apache.

Andy Smith
  • 3,308
  • 4
  • 26
  • 34
f4nt
  • 2,661
  • 5
  • 31
  • 35
3

You might take a look at this http://code.google.com/p/urlrewritefilter/

Alexandre Victoor
  • 3,104
  • 2
  • 27
  • 27
1

Sounds like you want to send an HTTP 301 Moved Permanently response.

RewriteCond %{REQUEST_URI} ^URI_TO_REDIRECT
RewriteRule redirect=301 NEW_SITE [L]

or similar. The [L] is to tell it to redirect immediately instead of continuing to rewrite.

Hank Gay
  • 70,339
  • 36
  • 160
  • 222
0

If you are routing through apache at all it is possible to use mod_rewrite; you just need to be careful as to where you declare the rewrite rules. Directory configs and .htaccess files won't work; you need it as a global configuration for the entire host. Similar thread on serverfault.

Community
  • 1
  • 1
Antitribu
  • 101
  • 2