Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite help

         

dbodami1

8:12 pm on Feb 8, 2005 (gmt 0)

10+ Year Member



I'm trying to write a rule that will rewrite users going to there home directory of their website

[mysite.edu...]

to the actual path on the server

[mysite.edu...]

running apache 2.052 on redhat linux. Any help appreciated

dbodami1

4:27 pm on Feb 9, 2005 (gmt 0)

10+ Year Member



Here's the code I have so far

RewriteRule ^/~([^/]+)/?(.*) [128.***.204.186...] [PT]

It seems to work pretty good but will not work for https://

How would I get this rule to rewrite in https only if I disable http?

[edited by: jdMorgan at 4:50 pm (utc) on Feb. 9, 2005]
[edit reason] Obscured specifics. [/edit]

Caterham

6:19 pm on Feb 9, 2005 (gmt 0)

10+ Year Member



Have you already tried

RewriteRule ^/~([^/]+)/?(.*) /$1/public_html/$2 [PT]

I think you won't need the full URl here.

Robert

dbodami1

7:00 pm on Feb 9, 2005 (gmt 0)

10+ Year Member



Thanks for the reply. I just tried that and it works for http but not https. I have both running and the application responds tp both but the rewrite rule is only working for http.

The web application is running on tomcat and I have setup Apache to proxy requests to the tomcat server so the url's I am trying to rewrite are all dynamicically generated, they do not sit in a physical path on the webserver. hope that makes sense

dbodami1

8:49 pm on Feb 9, 2005 (gmt 0)

10+ Year Member



I think I'm getting close. I have a rule setup to redirect this shortened url

[128.*.*.*...]
to the real dynamic url
[128.*.*.*...]

using the following mod_rewrite rules in the httpd.conf file

RewriteEngine on
RewriteLog /usr/local/apache2/logs/rewrite.txt
RewriteLogLevel 1
RewriteRule ^(.+[^/])$ $1/ [R]
RewriteRule ^/~([^/]+)/?(.*) /$1/public_html/$2 [PT]

my end goal is to get this to work only for https port443. I have ssl enabled and a test cert running which works for the rest of my app but does not work for this rule.

Any suggestions?