워드프레스 고유주소 hostname 설정 시 글쓸때 json error, 페이지 이동시 404 에러 해결방법

이 내용은 윈도우 apache 기준으로 한번 설명하고 윈도우 nginx 기준으로 한번 더 설명하겠다

방법이 다름

개인적으로는 nginx 가 더 깔끔하게 해결 됐다

 

1.apache

htdocs/ <— 보통 apache root 폴더 이다. 여기에 워드프레스 설치하고 작업하다보면 .htaccess가 설치 되는데 rewrite작업이란걸 해줘야 한다고 함 (왜그런지 모름)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

복사해서 맨 밑에 삽입한다

그 다음과정은 apache24/conf/httpd.conf 를 수정한다

#LoadModule rewrite_module modules/mod_rewrite.so 에서 앞에 # 주석 제거

전체 allowoverride none 를 allowoverride allow 로 구문 다 변경

requierd all denied 를 options all로 변경

Options Indexes FollowSymLink 한칸 띄고 MultiViews 추가

하고 apache 재시작  정상적으로 구동되면 오나성

 

2.nginx

nginx폴더/conf폴더/ nginx.conf 안에

server {
[...]

if (!-e $request_filename) {
    rewrite ^.*$ /index.php last;
}

[...]
}

server 부분에  문구를 사이에 집어넣어주고 재시작 하면 끝

 

직접 쓴 예제

server {
listen 80;
server_name localhost;
client_max_body_size 2000M;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.php index.html index.htm index.htm ;
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
try_files $uri $uri/ /index.php?$args;

}

#error_page 404 /404.html;

…..블라블라

이 게시물에 대해 평가 해주세요!

결과 0 참여자 0

Your page rank:

리플 남기기