I have a lamp stack app that is deployed to example.com/directory/ for production. The production environment redirects traffic to /directory/ and the app is served directly from that location.
When developing locally I would like to replicate this by serving files which live my apps root folder at
localhost:33309/directory/
instead of
localhost:33309
in my apps root .htaccess file I have tried a number of things. The example below does an ok job for redirecting traffic but how do I make that path serve content that does not live in /directory/?
RewriteEngine on
# route to directory from app root
RedirectMatch ^/$ /directory/
I don't want to create the /directory folder locally I just want to make my localhost appear like it is serving the app at a path of a non existent directory.
Wondering if I need to do something with VirtualHosts or if this is possible to configure?
Try with below rule,
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/directory/(.*)$
RewriteRule ^ /%1 [L]