워드프레스를 설치할때 계정의 root에 설치하면 상관없지만 다른 폴더가 있을 경우 지저분해 보일 가능성이 있다. 그래서 wordpress라는 폴더에다 설치하곤 하는데 그럴 경우 사이트 주소에

http://example.com/wordpress

처럼 보기 싫게 되는 경우가 있다. 이럴 때

/wordpress부분을 감추려면 어떻게 해야 할까.

우선 관리자의 설정 메뉴에 들어가보면 워드프레스 주소와 사이트 주소가 같이 되어 있을것이다.

ex) http://example.com/wordpress

여기에서 사이트 주소를

http://example.com

로 바꿔준다. 그리고 한가지 중요한 것은 /wordpress에 들어있던 index.php를 /에 복사한 다음 내용을 수정해 주어야 한다.

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

이런식으로 되어있는데.

require( dirname( __FILE__ ) . '/wp-blog-header.php' );

이 부분을 해당 url로 바꾸어준다.
즉 이런식으로.

require( './wordpress/wp-blog-header.php' );
Tags : #wordpress