Bobcares

Activate SSI Apache | Configuration setup

by | Sep 12, 2022

In this article, we will take a deeper look at how to Activate SSI Apache. Bobcares with help of our Server management support services will give you in a detailed note about SSI (Server Side Includes).

 

How to Activate SSI Apache?

 

The Server Side Includes (SSI) allows you to add files apart from header files on your web pages. They are mainly used to serve dynamic content on web pages and used to reuse HTML codes. For example, you can create a navigation bar/footer for your website, put it in a separate file, and include it on all your web pages.

Activate SSI Apache

 

Steps to enable Server Side Includes (SSI) in Apache

 

1. Open .htaccess or server configuration file

 

Initially, enable mod_rewrite (.htaccess) in your Apache web server, Open .htaccess file, that is located at /var/www/html/.htaccess

 
$ sudo vi /var/www/html/.htaccess
 

Alternatively, if you have access to the Apache configuration file, you can open it

$ sudo vi /etc/apache2/httpd.conf
 

2. Enable Server Side Includes

 

Add the following line to .htaccess:

AddType text/html .html 
AddHandler server-parsed .html 
Options Indexes FollowSymLinks Includes
 

If you have opened the server configuration file then add the following lines:

Options +Includes 
AddType text/html .html 
AddOutputFilter INCLUDES .html
 

The above lines will enable server side includes and instructs apache to look for SSI in .html files. You can enable server side includes for other file types by adding the below lines.

AddType text/html .shtml 
AddHandler server-parsed .shtml
 

3. Restart Apache web server

 

Next restart the Apache web server to apply changes:

# service httpd restart
OR 
# systemctl restart httpd
OR
# sudo service apache2 restart
 

4. Verify Server Side Includes

 

Finally, add the below line to your PHP web page” /index.php” to display today’s date on it.

<!--#echo var="DATE_LOCAL" -->
 

Open the browser and go to http://domainname_or_ip/index.php. You will get today’s date displayed at the same location where you have added the above code.

 

Example SSI  Directives

 

Now that you have SSI enabled on your Apache web server, further you can use some examples SSI directives in action.

Few syntaxes for SSI directives is as shown below:

    <!–#element attribute=value attribute=value … –>

To include a header on web pages:

    <!–#include virtual=”/header.html” –>

To include today’s date on a web page:

    <!–#echo var=”DATE_LOCAL” –>

Display the modification date of a web page:

    Document was last modified on <!–#flastmod file=”index.html” –>

 

Conclusion

Apache allows you to configure server-side includes (SSI) to add dynamic web content, HTML code, and it reuses them more efficiently.

 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF