Skip to content
Advertisement

.htaccess RewriteRule keeping URL structure

My current rewrite rule:

JavaScript

The result above works great so I can format the URL like

domain.com/a/b/c

I would like to add in a domain switch as well so the results I want is

sub.domain.com/a/b/c when you access it using domain.com/a/b/c

Currently here is what I have tried

JavaScript

But the result of this is

http://sub.domain.com/a=a&v=b&id=c

and needs to be

http://sub.domain.com/a/b/c

Thanks for the help!!

Advertisement

Answer

Reverse the order of your rules:

JavaScript

Make sure to test this after clearing your browser cache.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement