views:

279

answers:

2

Actually the thing is that i'm having a sub domain (example.domain.com) which is redirected from other domain of a folder (www.domain/folder) . but need the rewrite rule for my sub domain which shows the url links for the main domain ie., www.domain/folder/path i need to get as example.domain.com/path. Instead of getting the main domain path i need to expose the URL with sub domain path.

A: 

As far as I can tell, there are two ways to do what you are wanting. Both of them require significant extra overhead. Both are also likely to require example.domain.com to lie about who it is.

I wouldn't recommend either if you can avoid it, but.

Method #1

Set up a transparent proxy on www.domain.com/folder to show the contents from example.domain.com. If I recall correctly, this can be done with mod_proxy, but I don't remember how specifically.

Method #2

Set up a rewrite rule on www.domain.com/folder to redirect to example.domain.com. Then set up example.domain.com to either lie about who and where it is, or fix all links in pages on example.domain.com to explicitly go to http://www.domain.com/folder.

In the root .htaccess file on www.domain.com: (to redirect to the subdomain)

RewriteRule ^folder/(.*) http://example.domain.com/$1 [R, L]
Jason
please send me the rewrite rule for method 2.
Avvaru Vijay Kumar
sir as u given the rewrite.. i have implemented but that doesn't work
Avvaru Vijay Kumar
Dude, if you want people to help you out then you need to post more than "it didn't work".What happened when you tried it? Did the rewrite fail? Apache error page? Paste the rewrite rule you tried. Give some more info and people will try and help you.
Steve Claridge
A: 
Avvaru Vijay Kumar