Rewrite to domain based on subdirectory
3 posts
• Page 1 of 1
Rewrite to domain based on subdirectory
Hi,
I'm a noob with ISAPI_Rewrite so please be gentle![Smile :)](./images/smilies/icon_e_smile.gif)
www.fristdomain.com is the main domain and has a folder called seconddomain (http://www.fristdomain.com/seconddomain)
I'm looking for a way to do the following:
1. When a visitor goes to www.fristdomain.com/seconddomain redirect him/her to www.seconddomain.com
2. When a visitor goes to www.seconddomain.com, show the contents of www.fristdomain.com/seconddomain but leave the URL of www.seconddomain.com. For example www.fristdomain.com/seconddomain/test/something.html would be www.seconddomain.com/test/something.html in the browser.
Hope someone can help me out here![Sad :(](./images/smilies/icon_e_sad.gif)
Many thanks in advance.
Regards,
Frank
I'm a noob with ISAPI_Rewrite so please be gentle
![Smile :)](./images/smilies/icon_e_smile.gif)
www.fristdomain.com is the main domain and has a folder called seconddomain (http://www.fristdomain.com/seconddomain)
I'm looking for a way to do the following:
1. When a visitor goes to www.fristdomain.com/seconddomain redirect him/her to www.seconddomain.com
2. When a visitor goes to www.seconddomain.com, show the contents of www.fristdomain.com/seconddomain but leave the URL of www.seconddomain.com. For example www.fristdomain.com/seconddomain/test/something.html would be www.seconddomain.com/test/something.html in the browser.
Hope someone can help me out here
![Sad :(](./images/smilies/icon_e_sad.gif)
Many thanks in advance.
Regards,
Frank
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Rewrite to domain based on subdirectory
Hello Frank,
thanks for a clear description of what you need. As you have two tasks, there will be two rules for httpd.conf:
Regards
Andrew
thanks for a clear description of what you need. As you have two tasks, there will be two rules for httpd.conf:
- Code: Select all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP:Host} ^www\.fristdomain\.com$ [NC]
RewriteRule ^seconddomain(/.*)$ http://www.seconddomain.com$1 [NC,R=301,L]
RewriteCond %{HTTP:Host} ^www\.seconddomain\.com$ [NC]
RewriteRule (.*) http://www.fristdomain.com/$1 [NC,P,L]
Regards
Andrew
Re: Rewrite to domain based on subdirectory
I find this helpful since I have tried it and it worked.
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 7 guests