0

I am working a new HTML pages which will replace a Joomla website on same domain. The Joomla site is using SEF URLs ex.

www.mydomain.com/en for home page in English
www.mydomain.com/about-us for about us page in English
www.mydomain.com/fr for home page in french

ans so on...

am using .htaccess to try to remove .html file extension (first 4 lines) and to keep the /en and /fr in the URLs (last line). Have moved all the site content in the /en sub folder and index-fr.html only in the /fr sub folder. The goal is that by default the visitor will reach the English version of the site. He can then shift to French version from there.

    RewriteEngine on 
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.html -f
    RewriteRule ^(.*)$ $1.html [NC,L]

    RedirectMatch ^/$ /en/
  1. The first part is not getting rid of the file extensions. I guess am missing something here.
  2. The redirection is working fine for EN but site layout is being broken when I go to www.mydomain.com/fr/index-fr.html (since I guess it's looking for CSS in the FR folder and I would prefer avoid duplicating CSS, scripts etc...)

I may be completely doing it the wrong way here. Any thoughts welcome.

Goble
  • 3
  • 3
  • 1. You are missing, that what is implemented there is the _opposite_ direction - it _adds_ the `.html` suffix, so that the actually existing files can be found on the disk. Changing what your links in your HTML code point to in the first place, is not mod_rewrite’s job - that is your responsibility. – CBroe Jul 31 '20 at 13:22
  • 2. That has been covered countless times already. https://stackoverflow.com/questions/12883273/url-rewriting-css-js-and-images-not-loading – CBroe Jul 31 '20 at 13:23
  • @CBroe Thanks noted. Any idea how I should tackle the 2nd part ? I.e getting my CSS loaded and so on for /fr/index-fr.html ? – Goble Jul 31 '20 at 13:51
  • That is already covered in the answers to the question I referred you to. – CBroe Jul 31 '20 at 13:53
  • If you are doing Joomla development, you owe it to yourself to join [joomla.se] Stack Exchange. – mickmackusa Sep 11 '20 at 14:02

0 Answers0