URL Rewrite Filter

Oh I’m still having trouble with two and rewrote them but no luck.

These used to have meta refresh in blank pages - do you think that could be the reason?


https://www.nsu.edu/blackboard/
https://www.nsu.edu/sel/blackboard/index


https://www.nsu.edu/admissions
https://www.nsu.edu/enrollment-manage…

Hi Debbie,

Can you quickly confirm that all of your previously working rewrite rules are still functional? One of my concerns for when your server team was setting this up was that they might add in the Filter rules to the web.xml located at {tomcat_root}/{my_site_apps}/ROOT/WEB-INF. The problem here would be that a full site publish would overwrite this particular web.xml file, causing your redirects to no longer function. More info on this is contained in our previous topic:

https://community.percussion.com/t/setting-up-redirects-for-tomcat-server/430/8

If your existing rewrite rules are still functional, please wrap your rules above in Code and Pre tags to ensure that I’m seeing the full syntax you’re using, like so:

 Rewrite rules go here.

Sorry - yes the others are working :slight_smile:

 
<rule> <br>
          <from>https://www.nsu.edu/blackboard/</from> <br>
          <to type="redirect">https://www.nsu.edu/sel/blackboard/index</to> <br>
      </rule>   
 
 
<rule> <br>
          <from>https://www.nsu.edu/admissions</from> <br>
          <to type="redirect">https://www.nsu.edu/enrollment-management/admissions/index</to> <br>
      </rule>   
 

Thanks for confirming that, Debbie. I’m guessing you were having issues with these rules in particular because the from and the to have matching patterns, causing a redirect loop (which is possibly why you added the full domain). The best way to setup these types of redirects (and a general good practice so that rules don’t conflict) is to open the from URL with a caret character, like so:

  <from>^/blackboard(.*)</from> <br>
  <to type="redirect">/sel/blackboard/</to> <br> </rule>   
 
<rule> <br>
  <from>^/admissions(.*)</from> <br>
  <to type="redirect">/enrollment-management/admissions/</to> <br> </rule>```

I’ll try this and thank you very much.

It sincerely helps when I know there is someone more knowledgeable in an area that can assist me in figuring out what I am doing incorrectly.

Looks like the redirects are working – glad I could help!

We have two domains that point to the same location:

spfldcol.edu & springfieldcollege.edu

Is there a rule that would allow me to route all traffic from spfldcol.edu to springfieldcollege.edu ?

Is there any danger in setting up a rule like this, if it exists?

Hi Brian,

This is actually very common. From looking over Tuckey’s site (http://tuckey.org/urlrewrite/manual/2…), I believe the rule would look like this:

  <name>Domain Name Check</name> <br>
  <condition name="host" operator="notequal">www.springfieldcollege.edu</condition> <br>
  <from>^(.*)$</from> <br>
  <to type="redirect">http://www.springfieldcollege.edu/$1</to> <br> </rule>```   
 
This should reroute all requests to your server via any domain name other than [www.springfieldcollege.edu](http://www.springfieldcollege.edu) (spfldcol.edu, spfldcol.edu, springfieldcollege.edu, etc.) to [www.springfieldcollege.edu](http://www.springfieldcollege.edu). I don't have an environment up and running to test this, so please proceed with caution and be ready to roll back in case this doesn't work.

This sounds good. We have a handful of rules in place that direct traffic to another server, and we do this by redirecting them to http://www3 (as oppossed to http://www )

I’ve placed one of these rules below. I would like to give your example a try, but do you think the example you provided would still work with rules like the one below in place:

<rule> <br>
   <from>/homepage/athletics.nsf/(.*)</from> <br>
   <to type="redirect">http://www3.springfieldcollege.edu/homepage/athletics.nsf/$1</to> <br>
   <set type="status">302</set> <br> </rule>   

Brian,

Good catch, these two rules may very well conflict. I think what might work is ensuring that the rule above (redirecting to www3) appears above the global domain redirect, and then add a last=“true” property to the to element in the rule. According to the URLRewriteFilter manual, this will ensure that no more rules will be processed if this one is a match:

http://www.tuckey.org/urlrewrite/manu…

Again, I’m unable to test this to be sure, so be certain to back up the config file before modifying, to be sure that you can quickly revert back if there’s any trouble.