How to htaccess rewrite such that subdomain.domain.com accesses a subdirectory?

0

I do this all the time with Wordpress and it's easy, but I'm having trouble applying the same approach to an installation of OSTicket (support desk script).

I've installed the script in subdomain.domain.com/desk/ I would like all access to reference subdomain.domain.com/

As I said this works fine for WP, but it looks like internally OST is always forcing everything to point to the actual directory it's installed in, "desk" in this case. So while I can access the front page of the desk like I wish, all the links displayed and any navigation will take the user into /desk/ from that point onwards.

The rules I would use in WP are:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?subdomain.domain.com$
RewriteCond %{REQUEST_URI} !^/desk/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /desk/$1
RewriteCond %{HTTP_HOST} ^(www.)?subdomain.domain.com$
RewriteRule ^(/)?$ /desk/index.php [L] 
</IfModule>

I've asked on the OST forum but have not gotten a working answer. How can I make it so that nobody ever even sees there is a 'desk' folder in use?

JVC

Posted 2020-01-13T00:45:14.147

Reputation: 309

No answers