- Messages
- 5,093
- Reaction score
- 2,881
- Points
- 1,103
Hello,
today I will simply share this with you. How to remove file extentions from you're website.
To remove file extentions from urls you need to create a .htaccess file in your root folder of your server.
To remove the .html you need to copy this code into the file. (You can also use it with any other file extention e.g. .php)
If also want to remove the index from your index page of your site, copy this code below.
You can of course use booth together and simple download our template file below.
Thanks for reading, @CabCon.
today I will simply share this with you. How to remove file extentions from you're website.
To remove file extentions from urls you need to create a .htaccess file in your root folder of your server.
Code:
www.test.com/index.html -> www.test.com/index
To remove the .html you need to copy this code into the file. (You can also use it with any other file extention e.g. .php)
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]
Code:
www.test.com/index -> www.test.com
If also want to remove the index from your index page of your site, copy this code below.
Code:
RewriteRule ^index\.html$ / [R=301,L]
RewriteRule ^(.*)/index\.html$ /$1/ [R=301,L]
RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [NC,L,R]
You can of course use booth together and simple download our template file below.
Thanks for reading, @CabCon.