Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Hi Is it possible to do this using htaccess?

User access -> http:// mydomaina.com/dir/filename

and it will display the content from -> http:// mymainsite.com/anydir/mydomaina-filename

i did have a htaccess code but its not working maybe theres something missing

<IfModule mod_rewrite.c>
      RewriteRule ^dir/(.*)\.xml$ http://mymainsite.com/dir/%{HTTP_HOST}-$1.xml [P] 


share|improve this question
Are there any errors in the Apache error log? –  Phil Ross Aug 10 '10 at 8:38

2 Answers 2

up vote 0 down vote accepted

I RTFMed. It said:

^/somepath(.*) /otherpath$1 [P]                 doesn't make sense, not supported
^/somepath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo
                                            via internal proxy

So it looks like it should work. But..

Note: mod_proxy must be enabled in order to use this flag.

its not working

This is not a meaningful error message. What do your log files show? What happens if you try sending a redirect instead of proxying?


share|improve this answer

First thing that comes to mind is that mod_rewrite isn't on. Just loading the module isn't enough. Somewhere in your config you also need RewriteEngine On to enable it.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.