rewriterule for http and https - Websphere

This is a discussion on rewriterule for http and https - Websphere ; I have a website say www.example.com . This is setup for port 80 and 443. The redirect/rewrite rule I use currently is for the port 80 virtual host for example.com in my httpd.conf file. When the user types www.example.com I ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: rewriterule for http and https

  1. rewriterule for http and https

    I have a website say www.example.com. This is setup for port 80 and 443. The redirect/rewrite rule I use currently is for the port 80 virtual host for example.com in my httpd.conf file. When the user types www.example.com I want it to redirect to this URL below.

    https://www.example.com/webapp/wcs/s...d=100&type=Emp

    So in my Vitural Host for the www.example.com:80 I have my rewrite rule set as this below.

    RewriteEngine on
    RewriteCond %{QUERY_STRING} promo=1225
    RewriteRule /.* https://www.example.com/webapp/wcs/s...d=100&type=Emp [L]

    That part works great if I type http://www.example.com.

    In my Virtual Host for www.example.com:443, I don't have anything for RewriteRule, which my problem is if a user goes to https://www.example.com, I will just get a blank page and shows Index of / on it. How can I get the RewriteRule to work for both port 80 and 443 correctly? I tried the same RewriteRule that I have in my port 80 Virtual Host in my 443 Virtual Host stanza in my httpd.conf file, but then it will just keep looping the URL for some reason.

    So how can I get the RewriteRule to work for both port 80 and 443?

  2. Re: rewriterule for http and https

    mmeyer@cdsfulfillment.com wrote:
    > I have a website say www.example.com. This is setup for port 80 and 443. The redirect/rewrite rule I use currently is for the port 80 virtual host for example.com in my httpd.conf file. When the user types www.example.com I want it to redirect to this URL below.
    >
    > https://www.example.com/webapp/wcs/s...d=100&type=Emp
    >
    > So in my Vitural Host for the www.example.com:80 I have my rewrite rule set as this below.
    >
    > RewriteEngine on
    > RewriteCond %{QUERY_STRING} promo=1225
    > RewriteRule /.* https://www.example.com/webapp/wcs/s...d=100&type=Emp [L]
    >
    > That part works great if I type http://www.example.com.
    >
    > In my Virtual Host for www.example.com:443, I don't have anything for RewriteRule, which my problem is if a user goes to https://www.example.com, I will just get a blank page and shows Index of / on it. How can I get the RewriteRule to work for both port 80 and 443 correctly?


    >I tried the same RewriteRule that I have in my port 80 Virtual Host in

    my 443 Virtual Host stanza in my httpd.conf file, but then it will just
    keep looping the URL for some reason.
    >
    > So how can I get the RewriteRule to work for both port 80 and 443?


    It's gotta be conflicting with some existing Rewrite/Redirect in your
    port 443 vhost. Try turning on the RewriteLog and RewriteLogLevel 9 to
    debug.

  3. Re: rewriterule for http and https

    Here is my rewrite.log with loglevel 9. When I try to hit https://www.example.com it will just sit there and do nothing in the browser, but the rewrite log file keeps looping it looks like.

  4. Re: rewriterule for http and https

    Correction in my httpd.conf file in the 443 stanza for my rewrite.log file. I have this

    RewriteRule /server-status - [L]
    RewriteRule /.* https://www.example.com/webapp/wcs/s...ctiveLink=Home [R=301]
    RewriteLogLevel 9
    RewriteLog "/weblogs/rewrite.log"
    RewriteLogLevel 9

  5. Re: rewriterule for http and https

    mmeyer@cdsfulfillment.com wrote:

    > RewriteRule /.* https://www.example.com/webapp/wcs/s...ctiveLink=Home [R=301]


    Your pattern of "/.*" matches "/" and the URL you're redirecting to. Try
    the following which only matches a literal request for "/":
    RewriteRule ^/$ https://www....


  6. Re: rewriterule for http and https

    I tried it with the ^/? in both the 80 and 443 stanzas and the https://www.example.com works just fine, but if I try to go to http://www.example.com it won't bring up a page.

  7. Re: rewriterule for http and https

    mmeyer@cdsfulfillment.com wrote:
    > I tried it with the ^/? in both the 80 and 443 stanzas and the https://www.example.com works just fine, but if I try to go to http://www.example.com it won't bring up a page.


    That should end in a dollar sign, not a question mark

  8. Re: rewriterule for http and https

    Typo on the reply on here. I did have a $ instead of a ? in my RewriteRule in my httpd.conf file.

+ Reply to Thread