Forum Moderators: phranque

Message Too Old, No Replies

Is it possible with mod rewrite?

         

deviss

2:40 am on Feb 27, 2012 (gmt 0)

10+ Year Member



Hello

I've searched around google for quite some time and haven't found exactly my problem but only simillar answers that didn't worked.

I am using .htaccess to host multiple domains on one ip address.

The main ip address is allocated for domain.com (as example)

so we have /var/www and folders created for each domain

/var/www/site2
/var/www/site3

I'm using htaccess to point separate domains such as seconddomain.com to show /var/www/site2 content and thirddomain.com to show /var/www/site3 content. Everything works fine here.

But if i try for example to visit domain.com/site2 or domain.com/site3 i would like to redirect to their domains instead of showing content under the current address domain.com/site1 or domain.com/site2.


So when people would visit domain.com/site2 it should automatically redirect to it's own domain name which is secondarydomain.com (same applies for site3 example)

Also remember everything is on the same host and ip address so by accessing secondarydomain.com i would see the /var/www/site2 content and by accessing domain.com/site2 it should redirect to the same secondarydomain.com in address bar which would list thye same /var/www/site2 content

lucy24

4:23 am on Feb 27, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ouch. My head hurts. I think what you're talking about is one form of the redirect-plus-rewrite package?

user's address bar shows: www.shortprettyurl.com/file.html
real content lives at: long/complicated/messy/nest/of/directories/file.html

Like that? And you want to intercept the people who ask for

long/complicated/messy/nest/of/directories/file.html

and change their browser's address bar to read

www.shortprettyurl.com/file.html

Is that what you're describing?

If yes, pick any random ten threads in this Forum. At least two or three of them will be some variation of this question.

If no, post back and we'll figure it out.

deviss

10:01 am on Feb 27, 2012 (gmt 0)

10+ Year Member



I've tried to explain as detailed as possible.

So, when accesing domain.com/subfolder it should redirect me directly to it's own separate domain that i use for this folder called secondarydomain.com for example. Both domain and secondarydomain.com will be pointed to same ip address on same host.

deviss

10:26 am on Feb 28, 2012 (gmt 0)

10+ Year Member



so anyone can help?

wilderness

12:08 pm on Feb 28, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If yes, pick any random ten threads in this Forum. At least two or three of them will be some variation of this question.


lucy gave you an accurate answer

Here's a more focused search on example2 [google.com]

You might also explore the forum library [webmasterworld.com]