Add : 웹 버그 제거
This commit is contained in:
parent
168204708a
commit
590900d5ee
20
.htaccess
20
.htaccess
@ -1,23 +1,13 @@
|
||||
# Enable URL rewriting
|
||||
RewriteEngine On
|
||||
|
||||
# Force HTTPS (if SSL is available)
|
||||
# RewriteCond %{HTTPS} off
|
||||
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||
|
||||
# Remove trailing slashes
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)/$ /$1 [L,R=301]
|
||||
|
||||
# Remove .html extension
|
||||
# Remove .html extension from URLs
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^([^\.]+)$ $1.html [NC,L]
|
||||
RewriteRule ^([^\.]+)$ $1.html [L]
|
||||
|
||||
# Handle SPA routing - redirect all non-file requests to index.html
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ /index.html [L]
|
||||
# Redirect .html URLs to clean URLs
|
||||
RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
|
||||
RewriteRule ^ /%1? [NC,L,R=301]
|
||||
|
||||
# Handle 404 errors
|
||||
ErrorDocument 404 /index.html
|
||||
|
||||
@ -46,10 +46,18 @@ class CustomHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
|
||||
def do_GET(self):
|
||||
"""GET 요청 처리"""
|
||||
original_path = self.path
|
||||
|
||||
# 기본 파일 처리
|
||||
if self.path == '/':
|
||||
self.path = '/index.html'
|
||||
|
||||
# .html 확장자 없이 접근 시 자동으로 .html 추가
|
||||
elif not self.path.endswith('/') and '.' not in os.path.basename(self.path):
|
||||
html_path = self.path + '.html'
|
||||
if os.path.exists(html_path.lstrip('/')):
|
||||
self.path = html_path
|
||||
|
||||
super().do_GET()
|
||||
|
||||
def log_message(self, format, *args):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user