Mobile app version of vmapp.org
Login or Join
Correia994

: How to verify what modules are active on my server? While trying to solve a problem on my website, a recommendation about my .htaccess file I got was First of all, please check on the

@Correia994

Posted in: #Htaccess #Server

While trying to solve a problem on my website, a recommendation about my .htaccess file I got was


First of all, please check on the
server for all the different modules
if they are enabled, and once they
are, remove the


<IfModule
...></IfModule>



blocks. They are
putting an unnecessary strain on your
server.


I don't know where should I look to see if modules are active - is it in the CMS? in the httpd.conf file? in the files on my server? should I make a slight modification in the .htaccess as a test?
But more than that, could the recommendation self be not appropriate?
Thanks.

Here is the .htaccess file for which the recommendation has been made:

Options +FollowSymLinks -MultiViews
RewriteEngine on
AddHandler x-httpd-php .html .htm

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType text/css "access plus 2592000 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
</ifModule>

<ifModule mod_headers.c>
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>

<filesMatch ".(css)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>

<filesMatch ".(js)$">
Header set Cache-Control "max-age=216000, private"
</filesMatch>

<filesMatch ".(xml|txt)$">
Header set Cache-Control "max-age=216000, public, must-revalidate"
</filesMatch>

<filesMatch ".(html|htm|php)$">
Header set Cache-Control "max-age=1, private, must-revalidate"
</filesMatch>
</ifModule>

<ifModule mod_headers.c>
Header unset ETag
</ifModule>

FileETag None

<ifModule mod_headers.c>
Header unset Last-Modified
</ifModule>

RewriteCond %{HTTP_HOST} !^(www.)?foo.com$
RewriteRule .? foo.com%{REQUEST_URI} [R=301,L]
#BEGIN WordPress
<IfModule mod_rewrite.c>

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php

</IfModule>
# END WordPress

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Correia994

4 Comments

Sorted by latest first Latest Oldest Best

 

@Martha676

First of all, please check on the server for all the different modules
if they are enabled, and once they are, remove the <IfModule
...></IfModule>


About your query:
you need to check whether those modules are enabled on server, and if they are you can remove the if condition from htaccess:

e.g. if module mod_expires.c is enabled then you can remove the <IfModule mod_expires.c></IfModule> and you'll keep only this part:

ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"


so you're not checking anymore to see if that module is enabled because you already did that.

10% popularity Vote Up Vote Down


 

@Hamm4606531

If PHP is run as apache module, you can use the phpinfo() function. Search for the Apache section (usually apache2handler) and look for the row with "Loaded Modules":

10% popularity Vote Up Vote Down


 

@Candy875

If you don't have those modules loaded then it doesn't look anything's going to break on your site, it's just not going to have the best cache control settings. So leave out the ifmodules as you can't even load them if they aren't loaded. The apache website says


In normal operation, directives need not be placed in sections.

httpd.apache.org/docs/2.0/mod/core.html#ifmodule

10% popularity Vote Up Vote Down


 

@Kevin317

Assuming you mean apache modules you can run the below to list which modules you have loaded:

apachectl -t -D DUMP_MODULES

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme