It’s been a while since I have touched anything mod_rewrite related. Does anyone have a solid method for redirecting domain names but keeping the rest of the URL?
I actually did read through. Granted I didn’t take the 1-2 hours to read the whole thing but I went through the examples and didn’t see anything that either related or I could manipulate for my scenario.
Most the of the examples are focused on adding or removing extensions or rewriting query strings (?foo=bar).
From reading through your postings and google searches I get the below…
However this leaves a trailing slash (/) and generates a 404 page. One suggestion I showed that the code ^(.+)/$ was supposed to eliminate the trailing slash but that didn’t work for me.
%1 is created by the RewriteCond but it also includes the dot character (twice!) so that’s not a good thing. If you want JUST the subdomain (and NOT want it to include www), try
Then you can capture all the garbage you want with the RewriteRule and redirect it to {wherever}/%1$1 (because %1 was captured by the RewriteCond and $1 will contain the / from the original {REQUEST_URI}. Try it!