We have drupal 8 site with a folder in docroot. Lets say its in a folder called micrositefolder
. It contains a single index.html file.
Now let's say micrositefolder
lives on fullsite.com
. I dont want someone to access the microsite via fullsite.com/micrositefolder
, but instead only accessible via mymicrosite.com
I have already achieved that with the following:
# Prevent access to the static site from non-static site hosts.
RewriteCond %{REQUEST_URI} ^/micrositefolder [NC]
RewriteCond %{HTTP_HOST} !^mymiscrosite
RewriteRule .* /index.php [L,R=301]
# Only serve the static site if host begins with mymiscrosite.
RewriteCond %{HTTP_HOST} ^mymiscrosite
# Don't loop anything targeting the actual mask directory, to allow
# for linked scripts, stylesheets etc in the static HTML
RewriteCond %{REQUEST_URI} !^/micrositefolder/
#Any requests that made it this far are served from the /micrositefolder/ directory
RewriteRule ^(.*)$ /micrositefolder/$1 [PT]
That works great. I can now visit mymicrosite.com and it serves me that index.html in that folder.
I now have to include another page on that microsite. The url would be mymicrosite.com/ronnie
. I created a folder inside of micrositefolder
called ronnie
with another index.html
in it.
When I try to go to that url (mymicrosite.com/ronnie) it is being rewritten to mymicrosite.com/micrositefolder/ronnie/
and I cannot figure out why. I am pretty sure it has to do with that last line in my code snippet, but I cannot figure out how to make it just be mymicrosite.com/ronnie
One thing to note is if I view the url via mymicrosite.com/ronnie/
it works, but if I dont include the slash at the end it redirects to mymicrosite.com/micrositefolder/ronnie