it-tools icon indicating copy to clipboard operation
it-tools copied to clipboard

[OTHER] how to set a subpath like "example.com/it_tool/xxxx"

Open momomobinx opened this issue 1 year ago • 20 comments

how to set a subpath like "example.com/it_tool/xxxx"

momomobinx avatar May 11 '24 01:05 momomobinx

and i

ghost avatar May 13 '24 05:05 ghost

I found a workaround with apache2 (same configuration could be implemented in nginx), basically you need to do some rewrites, but would be nice if BASEPATH can be implemented as part of configuration.

Redirect 301 "/it-tools" "/it-tools/"
        <Location /it-tools/>
                ProxyPreserveHost On
                ProxyPass http://localhost:9070/ retry=0 timeout=5
                ProxyPassReverse http://localhost:9070/
                RequestHeader set Connection ""

                AddOutputFilterByType INFLATE;SUBSTITUTE text/html application/javascript
                SubstituteMaxLineLength 500K
                Substitute "s|href=\"|href=\"/it-tools/|inq"
                Substitute "s|src=\"|src=\"/it-tools|inq"
                Substitute "s|\"assets/|\"it-tools/assets/|inq"
                Substitute "s|to:\"/\",class:\"hero-wrapper\"|to:\"/it-tools/\",class:\"hero-wrapper\"|inq"
        </Location>

You can find example here: https://sitnikov.eu/it-tools/ It is not perfect:

  1. Main page shows 404 instead of "main page", but if you click on "home" it will be fine.
  2. URL will be updated without basepath, but in a fact all scripts are loaded from the correct place. изображение

GAS85 avatar Jun 13 '24 22:06 GAS85

same request

AndrewDi avatar Jun 26 '24 09:06 AndrewDi