简体   繁体   中英

.htaccess configuration for homepage of wordpress site to a subdirectory and other pages to root directory

I have a wordpress site live currently. I have recoded new homepage on a new wordpress installation which is under a folder main on live server.

I need .htaccess configuration which will map the homepage to new homepage without url redirect to subfolder and other pages will remain same.

Eg. when I open example.com, content of new wordpress site under main folder should be visible and other pages eg. example.com/about-us will display content of current live site under root directory.

I used this in hostgator. Note: latinstartup.com is the main domain of the account. This is the code for my .htaccess located in public_html folder. Good luck!

# Use PHP56
AddHandler application/x-httpd-php56 .php


# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.
# Do not change this line.
RewriteEngine on
# Change exampledomain.com to be your primary domain.
RewriteCond %{HTTP_HOST} ^(www.)?latinstartup.com$
# Change ‘subfolder’ to be the folder you will use for your primary domain.
RewriteCond %{REQUEST_URI} !^/latinstartup/
# Don’t change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change ‘subfolder’ to be the folder you will use for your primary domain.
RewriteRule ^(.*)$ /latinstartup/$1
# Change exampledomain.com to be your primary domain again.
# Change ‘subfolder’ to be the folder you will use for your primary domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?latinstartup.com$
RewriteRule ^(/)?$ latinstartup/index.php [L]

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