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.

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

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作