Forum Moderators: phranque
I found the following rewrite code, which is now in a .htaccess file in Apache's root directory and the subfolder:
RewriteEngine on
Options +FollowSymlinks
#
RewriteCond %{HTTP_HOST} ^(www\.)?otherdomain\.com
RewriteCond %{REQUEST_URI} !/subfolder/
RewriteRule (.*) /subfolder/$1 [L] This is working perfectly for direct requests to [otherdomain.com,...] however a request to a URL such as [otherdomain.com...] fail with a 404 by redirecting to http://example.com/somesubfolder/
Thanks in advance.
That is, it should rewrite:
otherdomain.com/ to /subfolder/
otherdomain.com/folder/ to /subfolder/folder/
otherdomain.com/file to /subfolder/file
otherdomain.com/folder/file to /subfolder/folder/file
The same is true for folder/file requests using the "www.otherdomain.com" hostname.
The only things I can think of to recommend are to completely-flush your browser cache before testing any new server-side code, and to be sure that your rule is not getting interfered-with by other redirects, rewrites, or mod_dir or mod_alias directives.
Jim