redirect - Wp-admin Redirection loop after moving to subdirectory

admin2025-01-07  4

I've moved my Wordpress files from public_html to a subdirectory public_hmtl/my-site. I've changed my .htaccess in the public_html directory by

RewriteEngine on RewriteCond %{HTTP_HOST} ^my-site$ [NC,OR] 
RewriteCond %{HTTP_HOST} ^www.my-site$ 
RewriteCond %{REQUEST_URI} !my-site/
RewriteRule (.*) /my-site/$1 [L]

I've configured my database and wp-config.php too, to:

define('WP_HOME','');
define('WP_SITEURL','');
define('RELOCATE',true);

But when I want to login per wp-admin the path seems to be like:

wp-login.php?redirect_to=https%3A%2F%2Fwww.my-site%2Fmy-site%2Fwp-admin%2F&reauth=1

Do you have any idea?

Thanks

Kamil

I've moved my Wordpress files from public_html to a subdirectory public_hmtl/my-site.com. I've changed my .htaccess in the public_html directory by

RewriteEngine on RewriteCond %{HTTP_HOST} ^my-site.com$ [NC,OR] 
RewriteCond %{HTTP_HOST} ^www.my-site.com$ 
RewriteCond %{REQUEST_URI} !my-site.com/
RewriteRule (.*) /my-site.com/$1 [L]

I've configured my database and wp-config.php too, to:

define('WP_HOME','https://www.my-site.com');
define('WP_SITEURL','https://www.my-site.com');
define('RELOCATE',true);

But when I want to login per wp-admin the path seems to be like:

wp-login.php?redirect_to=https%3A%2F%2Fwww.my-site.com%2Fmy-site.com%2Fwp-admin%2F&reauth=1

Do you have any idea?

Thanks

Kamil

Share Improve this question asked Jan 17, 2019 at 10:51 KamilKamil 11 bronze badge 1
  • Hey, I don't know why you are using .htaccess to . redirect, you would have done directly by changing the root folder from cPanel or apache config file. – Arvind Singh Commented Jan 17, 2019 at 11:44
Add a comment  | 

1 Answer 1

Reset to default 0

try this >>

step 1) on wp-config.php

define('WP_HOME','https://www.my-site.com/my-site.com');
define('WP_SITEURL','https://www.my-site.com');
define('RELOCATE',true);

now, on your /index.php change this line: require( dirname( FILE ) . '/wp-blog-header.php' ); to

require( dirname( __FILE__ ) . '/my-site.com/wp-blog-header.php' );
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736253251a109.html

最新回复(0)