htaccess - Wordpress sites in subfolders

admin2025-06-06  8

I have a slightly different question to the usual 'how to put WP into a subfolder'

I have two completely separate variants of the same WP site online - a live and a test one. The sites are in separate folders /livesite and /testsite on my hosted webserver.

If people browse the base domain I want them to access the live WP site in the /livesite folder but without the /livesite/ appearing in the browser URL.

If people browse the test domain (ie domain/testsite) then I want them to access the test site WP in the /testsite folder and I do want the /testsite/ to appear in the URLs (as confirmation that some nastly link hasn't accidentally redirected them from the test to the live site)

Is this possible? I have the live site set up with the (below) .htaccess but am unsure how to redirect /testsite requests appropriately - of even if I need to do this - will the current .htaccess ignore requests to professionalhypnotherapynetwork/testsite ?

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?professionalhypnotherapynetwork$
RewriteCond %{REQUEST_URI} !^/livesite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /livesite/$1
RewriteCond %{HTTP_HOST} ^(www.)?professionalhypnotherapynetwork$
RewriteRule ^(/)?$ livesite/index.php [L] 
</IfModule>
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749219972a317367.html

最新回复(0)