How to redirect subdirectory & its links from like:
mydomain.com/forums/
mydomain.com/forums/linkh.php?blahblkahblahblha?
to:
mydomain.newforums/
mydomain.new/forums/linkh.php?blahblkahblahblha?
but keeping the root mydomain.com accessible normally.
CodePudding user response:
Well, you implement a redirection rule that gets applied to that base URL:
RewriteEngine on
RewriteRule ^/?forums https://example.com%{REQUEST_URI} [QSA,R=301,L]
That should should get implemented in the http server's host configuration of the original domain. If you do not have access to that (read: if you are using a really cheap hosting provider), then you can implement the same rule in a distributed configuration file (".htaccess") which should get placed in the DOCUMENT_ROOT directory of that http host.
It is a good idea to start using a R=302 temporary redirection. And to only change that to a R=301 permanent redirection once everything works as desired. That saves you the hassle of caching issues with early clients.
