Hi Guys,
I hope I’m posting this in the right forum. Apologies if not.
We’re in the process of developing a new site using Expression Engine. The current site has legacy .php and .html files which the client needs to retain (for affiliates etc), however we would like to keep the root www directory sacred - solely used for EE. I’d like to propose moving these over to a subdomain however I’m really not sure if it’s possible to achieve the ‘catch-all’ level of control I’m looking for using mod_rewrite.
For example:
Current structure: http://www.domain.com/affiliates/any/folder/file.php
I would like to redirect to : http://sub.domain.com/affiliates/any/folder/file.php
The important thing to note is that there are many files and folders within the ‘affiliates’ directory so what we’re looking for is a catch-all method of saying ‘anything inside of the affiliates folder, redirect it to this subdomain but keep all of the directory/file references after it’.
Is there a way of doing this using mod_rewrite?
I’ve tried the following in an .htaccess file :
RedirectMatch 301 ^/affiliates/.*$ http://sub.domain.com/affiliates/
but unfortunately it sent everything to the affiliates directory on the subdomain and didn’t retain the other parts of the URL.
E.G. http://www.domain.com/affiliates/any/folder/file.php
became
http://sub.domain.com/affiliates/ - /any/folder/file.php was missing
I hope this makes sense? Is there a way of doing this in Apache? As you can guess, my mod_rewrite knowledge is v.limited.
Hope someone can help?
Thanks,
Gary