Remove URL ending

Hi everybody,
I am not so familiar with htaccess coding, so maybe somebody can help:

I would like to remove the .html from all urls. I already have found a solution for the index page:

RewriteCond %{THE_REQUEST} index.html [NC]
RewriteRule ^index.html$ FILL-IN-YOUR-URL-HERE [L,R=301])

Is there a code for all the other pages of my websites?

Thanks!

Wouldn’t it be easier just to export as clean urls? If needs be you can set up redirects from the old to the new.

3 Likes

Hi @wolfganghofer

I create a htaccess file and use this code. Works for me …

#Rewrite Rules
RewriteEngine on

#Remove the html extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html

#Restrict access to .htaccess and hidden files
RewriteRule “(^|/).” - [F]

I found that code in this thread:

tom

1 Like

I just export with clean you are URL’s That does the trick

1 Like