? 가 디렉토리 명에 있는 경우 자동으로 제거
본문
<script>
(function() {
const currentUrl = window.location.href;
const urlParts = currentUrl.split('?');
// URL의 경로와 쿼리 문자열을 분리
const path = urlParts[0];
const query = urlParts[1] ? '?' + urlParts[1] : '';
// 경로와 쿼리 문자열을 분리
const pathParts = path.split('/');
const lastPart = pathParts[pathParts.length - 1];
// 파일 이름인지 확인
const isFile = lastPart.includes('.');
// 'write' 디렉토리가 포함되어 있는지 확인
const isWriteDir = pathParts.includes('write');
if (!isFile) {
// 파일 이름이 아닌 경우, 쿼리 문자열이 'write' 뒤에 있는 경우를 체크
if (!isWriteDir || !query) {
const newUrl = path;
// 현재 URL과 새 URL이 다를 경우에만 리다이렉트
if (currentUrl !== newUrl) {
window.location.replace(newUrl);
}
}
}
})();
</script>[/code]
gram 테마의 일부 리스트 페이지에서 오류가 발생하여서 만들었습니다.
카테고리 분류 학습 시스템 (총 0개 학습됨)
이 분류가 맞나요? 학습시켜주세요!
tak2님의 댓글
그누보드 짧은 url 기능 쓰면 gram 테마의 일부 페이지에서url 뒤?로 고통을 받아 구현.. Twave도 gram 기반이라 같은 문네 발생
(?뒤의 텍스트들 때문에 리스트 출력 안되는 오류 발생했었음)
list.skin.php에 넣어 사용