웹 루트 (public_html) 디렉토리에서 .htaccess 파일을 편집하여 내 웹 사이트의 URL에서 .html 확장자를 제거하려고합니다. 내 서버는 블루 호스트입니다.URL에서 .html 확장자를 제거하십시오.
문제점은 .htaccess 파일에서 이미 기본 도메인을 하위 디렉토리 용도로 리디렉션하기 위해 이전 설정이 있다는 것입니다.
스크립트는 다음과 같습니다. 또한 스크립트에서 나는 URL에서 확장 기능을 숨겨서 온라인에서 찾았습니다. (스크립트가 작동하지 않습니다.) 누군가가 문제를 해결할 수 있다면 정말 좋을 것입니다. 감사.
# Use PHP5.4 Single php.ini as default
AddHandler application/x-httpd-php54s .php
# BlueHost.com
# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?qinglish.ca$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/qinglish_ca/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /qinglish_ca/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by/then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?qinglish.ca$
RewriteRule ^(/)?$ qinglish_ca/index.html [L]
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
정확히 작동하지 않는 항목은 무엇입니까? – anubhava
.html 확장자는 여전히 – Qing