I have a problem with the rewriterule on my openlitespeed server. Within the home page of my page(wordpress): domainweb.com I have a button that when clicked takes me to a test that is in another web application with the following domain: domainapp.com/test/any_thing. I want that when clicking on said "test" button it takes me to the application but that it continues to keep me domainweb.com/test/any_thing
#HTACCESS FINAL
RewriteEngine On
RewriteRule ^/test/(.*)$ https://dominioapp.com/test/$1/ [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I want to know what is wrong with my htaccess
This is not possible by means of rewriting alone. Reason is that rewriting only works internally . You'd need proxy module for this, which obviously means that the proxy module has to be installed and enabled.
First options directly using the proxy module:
Second option using the proxy module embedded in the rewrite module:
(The
RewriteCondis only required if both hosts are served from the same location, so if those rules are processed for both requests.)However you need to keep in mind that you have a penalty for such a setup: two full http roundtrips for each request initiated by the client. That means longer load time and additional load on the server side.
Here is the documentation of the proxy module, that documentation should always be the first place to start: https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html
[Disclaimer: I have not tested above lines but just written them down. I hope there is no typo.]