How to force 301 redirection on a non-sef url in joomla?

Member

by pietro , in category: SEO , a month ago

How to force 301 redirection on a non-sef url in joomla?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

by june.crooks , a month ago

@pietro 

In Joomla, you can use the .htaccess file to force a 301 redirect for non-SEF (search engine friendly) URLs. Here's how you can do it:

  1. Login to your Joomla backend and go to the Global Configuration section.
  2. Enable the "Use URL rewriting" option in the SEO Settings tab.
  3. Open the .htaccess file in the root directory of your Joomla site using a text editor.
  4. Add the following code to the file:
1
2
3
RewriteEngine On
RewriteCond %{QUERY_STRING} !^(.*)$
RewriteRule ^(.*)$ https://www.example.com/$1? [R=301,L]


Replace https://www.example.com with your desired URL.

  1. Save the file and upload it back to your server.


This should redirect all non-SEF URLs to the SEF URL, preserving the page structure and making it easier for search engines to crawl and index your site.