본문 바로가기

[RewriteRule] URL에서 .html 삭제하기

MintState 2015년 1월 14일 오전 11:37 조회 12616

[RewriteRule] URL에서 .html 삭제하기

How to remove .html from URL

DirectoryIndex index.html
#AddType application/x-httpd-php .jio

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]

#301 from example.com/page.html to example.com/page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1 [R=301,L]

출처 : http://stackoverflow.com/questions/5730092/how-to-remove-html-from-url

공유 X Facebook LINE QR 코드

댓글 0개

첫 댓글을 남겨보세요.