Insert HTML code in all pages via Apache?

前端 未结 3 1263
青春惊慌失措
青春惊慌失措 2021-01-13 03:17

I don\'t know if Apache or .htaccess is the right way, but I like to know how to insert an HTML code to all pages inside a public_html directory, k

3条回答
  •  不要未来只要你来
    2021-01-13 03:45

    i can insert html to all pages via Apache, but only for site that hosted by my apache, not all site though my apache proxy server.

    this is how it work. i set up an XAMPP, download mod_layout 5.1 for apache 2.4. (install mod_layout is simple, if you use XAMPP for windows, just download mod_layout.so 5.1 for windows and put it to your apache module folder $home/apache/module, then add the config DSO to your httpd.conf LoadModule layout_module modules/mod_layout.so - if you using linux or other os, you should download mod_layout.so for linux, then run make command to install)

    After install mod_layout.so for windows, just put this code on your .htaccess file or httpd.conf your will get html insert to all your page:

    
    AddOutputFilter LAYOUT html 
    AddOutputFilter LAYOUT htm 
    AddOutputFilter LAYOUT shtml 
    AddOutputFilter LAYOUT shtm 
    AddOutputFilter LAYOUT cgi 
    AddOutputFilter LAYOUT php 
    LayoutFooter "C:/xampp/apache/cgi-bin/footer.php"
    
    

    C:/xampp/apache/cgi-bin/footer.php is where you put your html or php file, in my situation is C:/xampp/apache/cgi-bin/footer.php, but you can put it any where, just give the right path, you'll be fine

提交回复
热议问题