rewrite the value of html head > base > href

1.1k Views Asked by At

I am trying to change the value of the base href tag in the header with apache httpd 4.2.23.

This is my header:

<html>
   <head>
   <meta http-equiv="CONTENT-TYPE" content="text/html; charset=UTF-8">
   <title>hello</title>
   <base href="http://middleware.mylinux.com:8082/hello-app-0.0.7/">
   <link rel="icon" type="image/x-icon" href="image/favicon.ico">
   <link rel="stylesheet" href="lib/bootstrap/3.3.6/bootstrap.min.css">
   <link rel="stylesheet" href="lib/bootstrap/3.3.6/bootstrap-theme.min.css">
</head>

I tired to use substitute module but i think that it works on body instead of header section of the html document.

The original documentation says:

mod_substitute provides a mechanism to perform both regular expression and fixed string substitutions on response bodies.

Could you please tell me what is the proper way to rewrite the header base content?

Thank you!

1

There are 1 best solutions below

0
On BEST ANSWER

The following lines work fine:

<VirtualHost>
      # replace "middleware.mylinux.com:8082/hello-app-0.0.7" to "web.mylinux.com/hello"
      AddOutputFilterByType SUBSTITUTE text/html
      Substitute "s|middleware.mylinux.com:8082/hello-app-0.0.7|web.mylinux.com/hello|ni" 
</VirtualHost>

Thanks for the comment @ezra-s.