My intent would be to rewrite web addresses ending inshtml code to .php (not really these, but that should not really matter regarding this). I'd like to disallow web addresses ending insperl (to ensure that the consumer can access every page only using web addresses with .html extension).

I am with such rules inside .htaccess:

RewriteRule ^(.*)\.php$ $1.html [R,L]
RewriteRule ^(.*)\.html$ $1.php [L]

However, this will cause a redirection loop. I guess this occurs since the rewritten .html to .php url is given to mod_rewrite and results in the very first rule to trigger.

Can anybody assist me to?

I am unsure what the advantage of carrying this out is, presuming you simply have your link Web addresses pointing towards the .html pathways, but that aside, you are factual that the rewritten URL is given to mod_rewrite. This can always happen when utilizing it inside a per-directory (.htaccess) context, because mod_rewrite needs to assign itself because the request handler to operate properly within this stage from the Apache request process chain.

Dealing with your actual problem, you are able to solve the issue by conditioning the very first rule based on the initial request delivered to the server. This may be done like so:

RewriteCond %{THE_REQUEST} ^[A-Z]+\s([^\s]+)\.php\s
RewriteRule .* %1.html [R=301,L]

RewriteRule ^(.*)\.html$ $1.php