.htaccess Joomla! 6 Joomla! 5 Joomla! 4 Joomla! 3 (Legacy) Template Basic

Write Clean 301 Redirects Without Breaking Joomla SEF Routing

Uses mod_rewrite RewriteRule [R=301,L] above the Joomla Core SEF block so old URLs redirect cleanly without index.php artifacts.

Updated on 24 November 2026 42 copies 146 views
.htaccess
# Redirecionamentos 301 personalizados (posicione ANTES do bloco Joomla Core SEF)
RewriteRule ^pagina-antiga/?$ /pt/nova-pagina [R=301,L]
RewriteRule ^blog-antigo/(.*)$ /pt/blog/$1 [R=301,L]

# Remove barra final duplicada (exceto diretórios reais e /administrator)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/administrator/
RewriteRule ^(.+)/$ /$1 [R=301,L]
Place all custom 301 rules BEFORE Joomla core RewriteRule .* index.php [L].

Technical explanation and best practices

Mixing mod_alias Redirect directives with Joomla mod_rewrite SEF rules often produces broken /index.php redirects. Always use RewriteRule before the core SEF section.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.