Advertisement

Remove .html suffix and redirect Topic is solved

Need help with the Administration of your Joomla! 4.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
User avatar
TheAnt
Joomla! Explorer
Joomla! Explorer
Posts: 453
Joined: Wed Aug 31, 2005 7:43 am
Location: Milano - Italy

Remove .html suffix and redirect

Post by TheAnt » Thu Sep 12, 2024 8:33 am

Hi, I would like to remove the .html suffix from the pages of my joomla 4 site and set a global redirect. Which method do you suggest?

Advertisement
User avatar
AMurray
Joomla! Master
Joomla! Master
Posts: 10193
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: Remove .html suffix and redirect

Post by AMurray » Thu Sep 12, 2024 11:14 am

In the SEF options remove the .html from pages. (that shouldn't be on by default).
https://docs.joomla.org/Special:MyLangu ... (SEF)_URLs

What do you mean "global redirect"? If you mean one domain name to another, that sounds like something you need to do in your web hosting not in Joomla.
You can add the 301(permanent) redirects to your .htaccess file - see this for example:
https://docs.joomla.org/Creating_301_redirects
Regards - A Murray
General Support Moderator

User avatar
TheAnt
Joomla! Explorer
Joomla! Explorer
Posts: 453
Joined: Wed Aug 31, 2005 7:43 am
Location: Milano - Italy

Re: Remove .html suffix and redirect

Post by TheAnt » Thu Sep 12, 2024 1:09 pm

Thanks for reply. I mean set a redirect for all urls with the .html suffix to the corresponding ones without the suffix, without having to set them one by one.

User avatar
AMurray
Joomla! Master
Joomla! Master
Posts: 10193
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: Remove .html suffix and redirect

Post by AMurray » Thu Sep 12, 2024 9:13 pm

I don't know then if you can do that in the joomla redirect component with some sort of wild-card redirect.

You would need to do that in .htaccess, external to Joomla. (per second link I provided).

But you can turn off the .html suffix, as mentioned in the SEF options. No need to redirect anything.

Unless I'm misunderstanding your question.
Regards - A Murray
General Support Moderator

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44559
Joined: Sat Apr 05, 2008 9:58 pm

Re: Remove .html suffix and redirect

Post by Webdongle » Thu Sep 12, 2024 9:53 pm

You could try redirecting in .htaccess
try

Code: Select all

########## Begin - Redirect html to non html
RewriteCond %{THE_REQUEST} \.html
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]
########## End - Redirect html to non html

Put in the correct place

Code: Select all

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
########## Begin - Redirect html to non html
RewriteCond %{THE_REQUEST} \.html
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]
########## End - Redirect html to non html
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

Advertisement

Post Reply

Return to “Administration Joomla! 4.x”