Disable Joomla registration, and contact form module

The default url for Joomla to access the user registration page form without creating a menu link is:

index.php?option=com_users&view=registration

Just add that string after yourwebsite.com

For example:
http://www.yourwebsite.com/index.php?option=com_users&view=registration

The default url for Joomla to access the user contact form page form without creating a menu link is:

index.php?option=com_contact&view=contact&id=1

Just add that string after yourwebsite.com

For example:
http://www.yourwebsite.com/index.php?option=com_contact&view=contact&id=1

If you want to disable, but not access the Joomla! administration interface, you could disable in the phpMyAdmin

Open the phpMyAdmin interface, and find the jos_extensions table, then find the com_users element row, and set the enabled column value to 0.

UPDATE `jos_extensions` SET `enabled` = '0' WHERE `jos_extensions`.`element` = `com_users`;

If you want to disable contact form, run the following query:

UPDATE `jos_extensions` SET `enabled` = '0' WHERE `jos_extensions`.`extension_id` = 8;

For older Joomal versions, the jos_components table can we disable the availability of these modules.

Disable URL with .htaccess file:

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{REQUEST_METHOD} ^.*POST.*
 RewriteCond %{THE_REQUEST} ^.*option=com_contac.* [NC,OR]
 RewriteCond %{THE_REQUEST} ^.*(option=com_contact&view=contact&id=).* [NC,OR]
 RewriteCond %{REQUEST_URI} ^.*/component/contact [NC,OR]
 RewriteCond %{REQUEST_URI} ^.*/component/users/* [NC,OR]
 RewriteCond %{THE_REQUEST} ^.*(option=com_users&view=registration).* [NC]
 RewriteRule ^(.*)$ index.php [F,L]
</IfModule>