Wordpress 사이트의 URL 및 VirtualHost 변경

Wordpress 사이트의 URL 및 VirtualHost 변경

내 상황을 설명하려고 노력하겠습니다. 도메인이 2개 있습니다.

www.impiantisaettasnc.it
www.oasisgaming.it

내 VPS에서 호스팅되는 2개의 다른 사이트 주소를 가리키도록 하고 싶습니다 x.x.x.x.

그래서 도메인 제어판으로 가서 VPS의 IP에 대한 DNS A 레코드를 입력했습니다 x.x.x.x.

다음으로 서버로 이동하여 다음과 같은 별도의 가상 호스트 2개를 만들었습니다.

 <VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName impiantisaettasnc.it
    ServerAlias www.impiantisaettasnc.it
    DocumentRoot /var/www/html/impiantisaetta

# BEGIN WordPress
        <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteRule ^index\.php$ - [L]
                RewriteCond $1 ^(index\.php)?$ [OR]
                RewriteCond $1 \.(gif|jpg|png|ico|css|js)$ [NC,OR]
                RewriteCond %{REQUEST_FILENAME} -f [OR]
                RewriteCond %{REQUEST_FILENAME} -d
                RewriteRule ^(.*)$ - [S=1]
                RewriteRule . /index.php [L]
        </IfModule>
    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog /var/www/html/impiantisaetta/vhost-error.log
    CustomLog /var/www/html/impiantisaetta/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    # Include conf-available/serve-cgi-bin.conf
</VirtualHost>

각 사이트마다 하나씩, 올바른 도메인 정보가 포함되어 있습니다.

그런 다음 각 wp-config 파일을 실행하고 끝에 다음 두 줄을 추가했습니다.

define( 'WP_HOME', 'http://www.site1.it' );
define( 'WP_SITEURL', 'http://www.site1.it' );

내가 읽은 것처럼공식 가이드. 현재 도메인은 올바른 사이트를 표시하지 않으며 어떤 방식으로든 제어판에 액세스할 수 없으며 내 IP나 도메인을 URL로 사용하는 것도 불가능합니다.

또한 내 # apachectl -S명령 출력

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server impiantisaettasnc.it (/etc/httpd/conf.d/impiantisaettasnc.it.conf:1)
         port 80 namevhost impiantisaettasnc.it (/etc/httpd/conf.d/impiantisaettasnc.it.conf:1)
                 alias www.impiantisaettasnc.it
         port 80 namevhost oasisgaming.it (/etc/httpd/conf.d/oasisgaming.it.conf:1)
                 alias www.oasisgaming.it
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html/main"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex default: dir="/run/httpd/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: _RH_HAS_HTTPPROTOCOLOPTIONS
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48
Group: name="apache" id=48

답변1

또한 phpmyadmin을 수동으로 업데이트하여 데이터베이스 값을 변경해야 합니다.

그렇지 않으면 WP를 사용할 수 있습니다DB 플러그인 마이그레이션로컬 작업에서 DB를 가져옵니다.

때로는 URL의 데이터베이스 값으로 인해 동일한 문제가 발생하는 경우도 있습니다.

관련 정보