dtwvr26066 2018-10-18 08:47
浏览 60
已采纳

Wordpress多个子安装 - htaccess / index.php

I have two wordpress installations - each in their own directory - on my one main domain. like mydomain.com/site1 and mydomain.com/site2

By default when visiting mydomain.com it redirects to mydomain.com/site1

I am unsure where this redirect is coming from. There is no .htaccess file in the root of the main domain mydomain.com nor any Index.php file in the root of the main domain.

I have also checked both .htaccess files of each directory installation mydomain.com/site1 and mydomain.com/site2 and do not seem to find what is causing the main domain mydomain.com to redirect to mydomain.com/site1

My main goal is to change the main domain mydomain.com to redirect to mydomain.com/site2 by default

The contents of each .htaccess are as follows:

Site 1 .htaccess

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

# END WordPress
# BEGIN wtfdivi
# END wtfdivi

Site 2 .htaccess

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

# END WordPress
# BEGIN wtfdivi
# END wtfdivi

The contents of both directories Index.php (mydomain.com/site1 and mydomain.com/site2 )are identical as follows

<?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' );
  • 写回答

1条回答 默认 最新

  • doubiaokai4998 2018-10-18 09:13
    关注

    So, Now you can set your redirect url from phpmyadmin.

    1. Go to your database and find the wp_options table.

    2. Now edit the siteurl column and set your domain url here you want to reditect.

    3. Then edit the 2nd column home for your home page and set the same url.

    Please clear the cache or press Ctrl+Shift+R or check it from the new incoming window.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 关于#html5#的问题:H5页面用户手机返回的时候跳转到指定页面例如(语言-javascript)
  • ¥15 无法使用此凭据登录,因为你的域不可用,如何解决?(标签-Windows)
  • ¥15 yolov9的训练时间
  • ¥15 二叉树遍历没有报错但无法正常运行
  • ¥15 在linux系统下vscode运行robocup3d上场球员报错
  • ¥15 Python语言实验
  • ¥15 SAP HANA SQL 增加合计行
  • ¥20 用C#语言解决一个英文打字练习器,有偿
  • ¥15 srs-sip外部服务 webrtc支持H265格式
  • ¥15 在使用abaqus软件中,继承到assembly里的surfaces怎么使用python批量调动