Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

417
Views
redirect and hide port (folder) in apache virtualhost - xwiki

Env: Ubuntu 18, Apache2, XWiki 12.1 on JETTY 9.4

I have xwiki on https://wiki.company.com:8443/xwiki/ and I would like to hide port 8443 and optionaly /xwiki/. I have tried with virtualhost:

<VirtualHost *:443>
    ProxyPreserveHost On

    SSLProxyEngine On
    SSLProxyCheckPeerCN Off
    SSLCertificateFile      /etc/ssl/certs/company.crt
    SSLCertificateKeyFile   /etc/ssl/private/comapny.key

    ProxyPass / https://wiki.company.com:8443/xwiki/
    ProxyPassReverse / https://wiki.company.com:8443/xwiki/
</VirtualHost>

This similar solution works for many projects but not for xwiki. The problem is that in this solution xwiki has problem with loading some files because it still try to load files from https://wiki.company.com/xwiki/webjars/wiki%3Axwiki/drawer/2.4.0/css/drawer.min.css

instead of

https://wiki.hl-display.com/webjars/wiki%3Axwiki/drawer/2.4.0/css/drawer.min.css

So maybe is there any other solution like removing xwiki

    ProxyPass / https://wiki.company.com:8443/
    ProxyPassReverse / https://wiki.company.com:8443/

and redirect user when enter in browser exact https://wiki.company.com to https://wiki.company.com/xwiki/

Or mod rewrite to replace string

https://wiki.company.com/xwiki/hhh/jjj/aaa

To

https://wiki.company.com/hhh/jjj/aaa ?

I have try a lot of settings but without any success :(

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

OK, I found solution :) By adding 3 lines in VirtualHost

RewriteCond %{HTTP_HOST} wiki.company.com$ [NC]
RewriteCond %{REQUEST_URI} !^/xwiki/(.*)$
RewriteRule ^(.*)$ /xwiki/ [R=301,L]

So now when user enter exact URL: https://wiki.company.com it will redirect to https://wiki.company.com\xwiki\. So wiki works, port is hidden and nice URL works :)

so complete code is:

<VirtualHost *:443>
    ProxyPreserveHost On

    SSLProxyEngine On
    SSLProxyCheckPeerCN Off
    SSLCertificateFile      /etc/ssl/certs/company.crt
    SSLCertificateKeyFile   /etc/ssl/private/company.key

    RewriteEngine on
    ServerName https://wiki.company.com
    RewriteCond %{HTTP_HOST} wiki.company.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/xwiki/(.*)$
    RewriteRule ^(.*)$ /xwiki/ [R=301,L]
    ProxyPass / https://wiki.company.com:8443/
    ProxyPassReverse / https://wiki.company.com:8443/
</VirtualHost>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!