.htaccess - Remove extension .html and reedirect to www. from HTCACCES -


i trying delete .html extension in of web pages, , redirect of pages www. on htcacces, don't know how that. i've tried works redirect:

rewriteengine on rewritecond %{http_host} ^gangatravel.es$ rewriterule ^/?$ "http://www.gangatravel.es/" [r=301,l] errordocument 404 /notfound.html  rewritecond %{request_filename} !-d rewritecond %{request_filename}.html -f rewriterule ^(.*)$ $1.html 

for removing html file, must use below code:

rewriterule ^([^/]+)$ $1.html [l] 

and force www, use:

rewritebase / rewritecond %{http_host} ^www.yoursite.com [nc] rewriterule ^(.*)$ http://yoursite.com/$1 [l,r=301] 

Comments