简体   繁体   中英

Redirect root domain with https to subfolder with wordpress

I am trying to point the main domain from my host ( https://website.com ) which right now just goes to public_html to a subfolder in the public_html directory (new.website.com) with the user still seeing https://website.com without changing.

I tried doing what is found in here: https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

And added this code to the .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?website.com$
RewriteCond %{REQUEST_URI} !^/new.website.com/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /new.website.com/$1
RewriteCond %{HTTP_HOST} ^(www.)?website.com$
RewriteRule ^(/)?$ new.website.com/index.php [L] 

However 2 things happened incorrectly:

  1. The domain changed to https://new.website.com/404.html

  2. It is giving me a page to proceed with caution since new.website.com does not have a certificate.

(folder name and also a subdomain are both named: new.website.com)

How can i redirect so it still shows https://website.com and go to the wordpress folder?

If I understand your question right, you need to have website.com visible to the public but actually, WordPress is installed on new.website.com

In this case, you need to do Wordpress multisite.

Check: https://codex.wordpress.org/Create_A_Network

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM