So, you just want to inject a /client
subdirectory, for specific URLs, from the document root. You can do this using mod_rewrite, at the top of your .htaccess
file (before the WordPress front-controller). For example:
RewriteRule ^view(invoice|ticket)\.php$ /client/$0 [R=302,L]
This will redirect either /viewinvoice.php
or /viewticket.php
to /client/viewinvoice.php
and /client/viewticket.php
respectively. The query string is passed through to the target unaltered.
The $0
backreference in the substitution refers to the URL-path that matches the entire RewriteRule
pattern.
Note that this is currently a temporary (302) redirect. Change the 302 to 301 if this is intended to be permanent, but only once you have confirmed it works OK (to avoid caching issues). Make sure your browser cache is cleared before testing.