I love websites so much that I want to put a website into another website. I have a static site under /wp-content/uploads/site. It has a lot of pages and I can access it without an issue in https://[my-domain]/wp-content/uploads/site but I want it accessible as a root directory: https://[my-domain]/site

I tried adding the following rule to my .htaccess:

RewriteRule ^site/(.*)$ /wp-content/uploads/site/$1 [L]

This works because I can load the static site as https://[my-domain]/site but when I click on links (absolute URLs such as /site/url I get redirected to https://[my-domain]/wp-content/uploads/site/url

BTW: I added my rule right before RewriteRule ^index\.php$ - [L]

Any ideas on what's not working?

  • is the static site dependent from the main site? – Manyang Jun 11 '19 at 3:55
  • Is there a particular reason you placed the site in the uploads folder? You can simply move it to your domain's root directory (inside the site folder) to achieve your desired path. Is that not an option? – WSU Jun 11 '19 at 11:05
  • @Manyang thanks for your answer, it is not. They're completely independent of each other. – darkflamemaster Jun 11 '19 at 17:21
  • @WSU interesting... I didn't considered that because I thought it may make the structure a little "clumsy". By default, I like to put "storage" items in the upload folder and then create a redirection. – darkflamemaster Jun 11 '19 at 17:23
  • Well, it is the simplest solution I can offer. It would also make the subsite easier to reach. – WSU Jun 12 '19 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.