I'm looking for some help with my .htaccess file.
In short, I have a bunch of content up in the subdirectory www.myserver.com/forum/
(this directory is not my choice and cannot be changed), which includes both a forum (myserver.com/forum/forum
) and a wiki (myserver.com/forum/wiki
) and this is abviously not an ideal layout. I do not own myserver.com and there is content there that is not mine, though I have full access to the entire server.
I also have a domain name www.mydomain.com
, which I want to redirect and mask such that if a user goes to mydomain.com/<something>
they will be shown the content from myserver.com/forum/<something>
while still being shown mydomain.com/<something>
in the address bar.
One other thing I'd like to see, although it isn't vital, would by for a 404 generated by someone typing in mydomain.com/somethingThatDoesNotExist
should redirect to mydomain.com/404.php
instead of myserver.com's default 404.
I've tried a number of different approaches and searched extensively for the past day or so online - I'm sure that the answer is even here on SO somewhere, but all of the guides/examples I've tried have not worked and I feel like I'm going in circles.
Many thanks in advance.
EDIT: And I do know for sure that .htaceess is enabled.
if a user goes to mydomain.com/ they will be shown the content from myserver.com/forum/ while still being shown mydomain.com/ in the address bar.
First thing you need to understand that this is ONLY possible if mod_proxy
is enabled on the Apache server of mydomain.com
.
Once you've enabled mod_proxy, mod_rewrite and .htaccess through httpd.conf
on mydomain.com
, put this code in its .htaccess
under DOCUMENT_ROOT
directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteRule ^(.*)$ http://myserver.com/$1 [L,P]
I will have to think little more about your 404 requirement, but if you get this working I am sure we can find a workaround for that as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With