在wordpress中重定向mutlisite中的问题

时间:2016-06-07 07:02:01

标签: php wordpress

我需要在word press中集成多站点。

我的wp-config.php: -

define('WP_HOME','http://localhost.com/escort');
define('WP_SITEURL','http://localhost.com/escort');
define('WP_DEBUG', true);
// define('WP_ALLOW_REPAIR', true);
define( 'SUNRISE', 'on' );
define( 'PB_BACKUPBUDDY_MULTISITE_EXPERIMENT', true );
define( 'WP_MEMORY_LIMIT', '256M' );
define('ADMIN_COOKIE_PATH', '/');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');

define('WP_ALLOW_MULTISITE', true );

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
$base = '/';
define('DOMAIN_CURRENT_SITE', 'localhost.com/escort');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('NOBLOGREDIRECT', 'http://localhost/escort');




 My htaccess :- 
   RewriteEngine On
RewriteBase /escart/
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

它不起作用。我得到了以下错误 页面未正确重定向。我该如何解决这个问题。

2 个答案:

答案 0 :(得分:1)

DOMAIN_CURRENT_SITE,NOBLOGREDIRECT常量应该只是一个域。而是使用PATH_CURRENT_SITE常量

<?php
$base = '/escort/';
define('DOMAIN_CURRENT_SITE', 'localhost.com');
define('PATH_CURRENT_SITE', '/escort/');
define('NOBLOGREDIRECT', 'http://localhost.com');
?>

答案 1 :(得分:1)

    <?php
define( 'WP_ALLOW_MULTISITE', true );

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
$base = '/';
define('DOMAIN_CURRENT_SITE', 'localhost.com');
define('PATH_CURRENT_SITE', '/escort/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

    ?>

试试这个htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]