In addition, the rewrite rules consider other sub directories used in each sub-domain. I added these because the first rules, 1 and 2 below, work fine but have the side effect of looping through redirect URLs that contain "/ws/css" and similar.
I have two questions about the rewrite rules below:
A. How to write a rule to eliminate the "/ws" URL element if not part of "/ws/cgi_A" or "/ws/cgi_B"? That is, "subdomain/ws/css/" ought to be "subdomain/css/"
B. The current version, below, gets close but not quite. The rewrite log contains the following, which looks right but the browser does not load the js file.
- Code: Select all
internal redirect with /js/tablesorter/jquery-latest.js [INTERNAL REDIRECT]
B. In general, is there a nicer way to structure these rules?
TIA,
- Mophilly
Short "public" urls:
www.maindomain/cgi_A/C2456D78
www.maindomain/cgi_B/E2L00087F2495876
The real paths look like this:
- Code: Select all
.../htdocs/mysubdomain
/htdocs/mysubdomain/css
/htdocs/mysubdomain/images
/htdocs/mysubdomain/js
Here is the Apache directives I am using:
EDIT: I realized the original example was totally wrong. I replaced it with the current version, which also does not work as desired but is *a lot* cleaner and (I hope) closer to hitting the mark.
- Code: Select all
<DirectoryMatch /mysubdomain>
AllowOverride None
RewriteEngine on
# handle sub-directories
RewriteRule ^.+(/css/.+)$ $1 [L]
RewriteRule ^.+(/images/.+)$ $1 [L]
RewriteRule ^.+(/js/.+)$ $1 [L]
#
### check for short URLs to be handled by custom modules
#
# 1. check for "action" short URL
RewriteCond %{REQUEST_URI} !^/mysubdomain/cgi_A$ [NC]
RewriteRule /PendingAction/([0-9]+)$ /mysubdomain/webapp?OmnisLibrary=APPSERV&OmnisClass=rt_Main&OmnisServer=5914&ActionId=$1 [R,L]
#
# 2. check for "document" of short URL
RewriteCond %{REQUEST_URI} !^/mysubdomain/cgi_B$ [NC]
RewriteRule /ws/([a-z0-9]+)$ /mysubdomain/webapp?OmnisLibrary=APPSERV&OmnisClass=rt_Alternate&OmnisServer=5914&document=$1 [NC,L]
#
</DirectoryMatch>