Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rewrite an URL on a JBoss server?

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 ?

like image 465
Syl Avatar asked Sep 18 '08 08:09

Syl


People also ask

How do you rewrite a URL in HTML?

To rewrite urls you need to configure the webserver to do that (for example in apache with . htaccess . But if you want to do that without use server configuration, a bad solution exists: make a folder with the name of the url and put the html into that with the name index.

What is a URL rewrite rule?

A rewrite rule defines the logic of what to compare or match the request URL with, and what to do if the comparison is successful. Rewrite rules consists of the following parts: Pattern – The rule pattern is used to specify either the regular expression or a wildcard pattern that is used to match URL strings.

What is URL rewrite module?

About the URL Rewrite module The Microsoft URL Rewrite Module 2.0 for IIS 7 and above enables IIS administrators to create powerful customized rules to map request URLs to friendly URLs that are easier for users to remember and easier for search engines to find.

How to use REWRITE url in JBoss EAP 7?

Re: how to use rewrite url in jboss eap 7.0 You can configure a rewrite filter within the undertow subsystem, or you can add a undertow-handlers.conf file to the WEB-INF directory of your webapp. For the direct subsystem configuration, the "host" element can contain "filter-ref" children.

What is JBoss rewritemap?

Its class name is org.jboss.web.rewrite.RewriteMap, and its code is: The RewriteRule directive is the real rewriting workhorse. The directive can occur more than once, with each instance defining a single rewrite rule.

What does ${1} mean in JBoss EAP?

anuj_kumar - the $ {1} is the contextual value from the regex command (.*). In your case, it's whatever comes after "scripts/". 4. Re: how to use rewrite url in jboss eap 7.0 I am using jboss eap 7.0 . I am getting error WFLYCTL0211: Cannot resolve expression 'path-prefix'. whats your thoughts on this. 5. Re: how to use rewrite url in jboss eap 7.0

How do I configure a rewrite filter for a web application?

You can configure a rewrite filter within the undertow subsystem, or you can add a undertow-handlers.conf file to the WEB-INF directory of your webapp. For the direct subsystem configuration, the "host" element can contain "filter-ref" children.


2 Answers

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.

like image 133
f4nt Avatar answered Sep 23 '22 18:09

f4nt


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

like image 44
Alexandre Victoor Avatar answered Sep 22 '22 18:09

Alexandre Victoor