Issue
AWS CentOS 64b / HTTP / Wildfly 10 / PHPBB php forum / java project
Scenario :
My URL is : www.apisani.org
I have httpd listening on port 80
I have Wildfly listening on port 8080
My needs : I need to type in the browser : www.apisani.org and be redirected to wildfly - java application on port 8080 but dont want to show the port number in the URL.
I need to type in the browser : www.forum.apisani.org and be redirected to httpd on port 80 - phpbb forum website.
I know how to setup wildfly in standalone.xml and welcome-content to redirect www.apisani.org to www.apisani.org/app/indexapp.xhtl but the problem is given above on "My needs" section
[UPDATED BASED ON FISH REPLIES...]
We are almost there !
The <virtualHost>
is working like a charm !
:( The ReWriteConde redirects to wildfly URL app instead of forum...
RewriteCond %{HTTP_HOST} ^www\.forum\.apisani\.org$
RewriteRule (.*) http://apisani.org:80/phpBB3/$1 [P,L]
RewriteCond %{HTTP_HOST} ^forum\.apisani\.org$
RewriteRule (.*) http://apisani.org:80/phpBB3/$1 [P,L]
<VirtualHost *:80>
Servername www.apisani.org
ServerAlias apisani.org
ProxyPreserveHost on
ProxyPass / http://apisani.org:8080/app/index
ProxyPassReverse / http://apisani.org:8080/app/index
</VirtualHost>
Solution
I'd suggest to use a rewrite and [P] for that:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.apisani.org$
RewriteRule (.*) http://wildfly:8080/$1 [P,L]
RewriteCond %{HTTP_HOST} ^www.forum.apisani.org$
RewriteRule (.*) http://phpbb-forum-website:80/$1 [P,L]
$1 refers to (.*) --> the whole URI. If you want to pass that to your application. If not, just lose the brackets and $1
Let us know if that was what you were looking for. And if not, even more, so we can help furthermore ;)
UPDATE
RewriteCond %{REQUEST_URI} !^/php
RewriteCond %{HTTP_HOST} ^(www\.)?apisani\.org$
RewriteRule ^/(.*)$ apisani.org:8080/<path> [P,L]
RewriteCond %{HTTP_HOST} ^(www\.)?forum\.apisani\.org$
RewriteRule ^/(.*)$ apisani.org/<path> [P,L]
Answered By - Hello Fishy Answer Checked By - David Marino (WPSolving Volunteer)