Need a solution regarding domain url folder to redirect to subdomain url using vhosts only

Firstly forgive my lack of knowledge in this area.

I have a subdomain that is setup and directs to domain by default,

I need the subdomain to direct to a folder/file within the domain without changing the subdomain url.

eg… sub.example.com to point to example.com/folder.php?name=forums but keep the subdomain url… sub.example.com and also when accessing example.com/folder.php?name=forums it needs to redirect to sub.example.com as well.

I need to only make this change in my vhosts file if I can.

Server running apache 2.4 I can permanent redirect in vhosts sub.example.com to example.com/folder.php?name=forums but dont know how to keep the sub.example.com url from changing.

Have used this in vhosts

Redirect permanent / http://www.example.com/folder.php?name=Forums

The redirect works fine but I need it to not show example.com/folder.php?name=Forums but keep the url of the subdomain sub.example.com

Thank you for any help or solutions.

If I understand correctly you’d want this:

Redirect permanent / http://sub.example.com/folder.php?name=Forums

No this wont work.
I need to rewrite/redirect example.com/folder.php?name=forums to sub.example.com
I need the rewrite/redirect to change to the new url while serving the old content.
So if I visit sub.example.com it will show me the content from example.com/folder.php?name=forums
Thanks for any Ideas/solutions.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.