0

I need some help with .htaccess as I am very new at this.. Here is my situation:

I want to have a short url http://example.com/shorturl point to https://example.com/apps/appname (non-ssl to ssl) but I want to make sure the URL doesn't change in the browser.

now, at example.com/apps/appname level, I have iis url rewrite rule set up so all http traffic is redirected to https and it works as it should.

to achieve my goal i spent a few good hours trying to figure out by researching online but couldn't get it to keep the shorturl. No matter what I tried it keeps changing the URL in the browser to https://example.com/apps/appname.

Here is one of many methods i tried

RewriteCond %{REQUEST_URI} (shorturl) [NC] RewriteRule ^(.+)$ http://example.com/apps/appname [P]

also tried RewriteRule ^(.+)$ https://example.com/apps/appname [P] but again, it doesn't keep the URL.

does having the http to https redirect set up at the ../../appname level make any kind of difference as oppose to having it configured at the root?

Any help in getting this figured out would be greatly appreciated. Thanks in advance and hopefully I included all the detail

newb
  • 11
  • 1
  • You can't with .htaccess. You might want to try a reverse proxy, making sure that the reverse proxy handles the `https` with the target site. Have a look at this answer which essentially asking the same: https://stackoverflow.com/questions/987343/how-can-i-redirect-to-a-different-domain-without-changing-the-url-in-the-address – Marcel Steinbach Mar 25 '18 at 08:19
  • at which level would i set the reverse proxy if im trying to redirect a short url to another URL? In the link you provided, the person would set up the reveres proxy at domain1/photos level but in my case, there is no actual folder in iis i can configure this in as the "shorturlname" isn't an actual folder (http://example.com/shorturlname) – newb Mar 25 '18 at 16:22

0 Answers0