How to add .html extension in the page URL concrete5

165 Views Asked by At

I am changing an old site which contains links with .html extension. But I cannot seem to work with concrete5 to add .html extension.

I have tried to override several core classes but not working.

2

There are 2 best solutions below

1
On

You probably should do that through your htaccess. The same way you can use an htaccess directive to remove .php from URLs you can do the same to add .html

But really, why would you want to do that? If it's to make sure the old URLs still work you should just make sure htaccess redirects anything ending in .html to its equivalent without the .html

0
On

I'd approach this in the opposite direction. .html adds nothing semantically to the URLs anyway.

Use permanent 301 redirects from the old pages names to the new ones without .html in your .htaccess - pretty much the whole point of 301s, and you can even clean up some page names and add https along the way:

Redirect 301 /old_page_name.html https://newsite.com/page-name

Generate /sitemap.xml from a cron job, the search engines will find it.

You could submit it to Google, Bing, and Yahoo, but either way you won't lose any link juice and any sites linking to the old ones will get the right content.