![]() |
|
Remove .html extension - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Design (https://sinister.li/Forum-Design) +--- Forum: Web Design (https://sinister.li/Forum-Web-Design) +--- Thread: Remove .html extension (/Thread-Remove-html-extension) |
Remove .html extension - par†ian - 01-10-2014 Hey guys, I am busing developing a website for a music group and I am having a few problems. I am trying to eliminate the .html extension at the end of the URL so it looks clean and fresh. Quote:http://www.example.com/home.html I searched around and I got a .htaccess code to help me however it's still not working. Code: .htaccess code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]I then change the a href tag as instructed Code: Before: <a href="/home.html">Home</a>
After: <a href="/home">Home</a>
I even ttied <a href="http://www.example.com/home"</a>But nothing happens apart from the server not being able to read the page (obviously) and just gives me a 404 page (error) I believe my hosting DOES allow .htaccess which editing is compatible, does anyone have any suggestions? Would be a major help, thanks Ryazz. RE: Remove .html extension - upsurt - 01-10-2014 maybe this will help ==> http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/ ==> http://corz.org/server/tricks/htaccess2.php can't test it right now, but I think this might help Code: .htaccess code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.html [NC,R=301,L]RE: Remove .html extension - maho - 01-10-2014 For me this is ok... Quote:# The following will allow you to use URLs such as the following: copy for https://gist.github.com/mudge/22877 RE: Remove .html extension - maho - 01-10-2014 Or only this if the server supports Quote:.htaccess code |