.htaccess and rewrite url

We have the following example of an "ugly" URL:

https://some.uglyurl.com/directory/test.jsp?hotelid=1111&rateplanid=33333

      

we need to direct our clients to the above url using our own domains url as an address so that it looks something like this:

https://www.PrettyURL.com/reservations?hotelid=1111&rateplanid=33333

      

The idea is that the address our customers "see" is a nice "familiar" URL for them. Is this possible in .htaccess? We'll stick with different variables AFTER test.jsp in the ugly url, so it can't just be a fixed set of variables.

thanks a lot for any help.

0


a source to share


3 answers


This is the code that worked for me:

RewriteCond %{HTTP_HOST} ^www.prettyurl.com$
RewriteRule ^reservations$ https://uglyURL.com/istay/istay.jsp?%2 [QSA,L]

      



It works exactly the way I need it.

Many thanks to Gumbo and others for their help.

0


a source


If you're just using plain HTTP, you can set up a pretty url server as a proxy that passes every request to the ugly url server and response to the client:

RewriteCond %{HTTP_HOST} ^pretty\.example\.com$
RewriteRule ^reservations$ http://ugly.example.com/directory/test.jsp [L,P]

      



But since you are using HTTPS, this is not possible without receiving an error that the hostname of the certificates is incorrect.

+2


a source


0


a source







All Articles