domain2.com/subfolder rewriting to show domain1.com?

Using a single web hosting account to host multiple sites

domain2.com/subfolder rewriting to show domain1.com?

Postby dbomestar » Fri Jul 25, 2008 12:49 pm

I parked and forwarded www.domain1.com to redirects to www.domain2.com/subfolder.

Now when I go to www.domain1.com it redirects to www.domain2.com/subfolder but I want it to show www.domain1.com in the adress bar.

Basically what I want is to have lot of "web sites" and each "web site" to have own domain but everyone to hosted in subfolder of single hosting.

I would like to have Wordpress installed on every "web site" so maybe this will complicate things?

I've tried a lot of combinations but I can't make it work.


p.s. in one of many combinations(and I don't know which) I came very close, it really worked, every single link on the website was showing a domain that I want, but me and one of my friend was seeing that and other to friends on their computers ware seeing "framed" websites and not rewrited?? Very ockward if you ask me. Does someone knows the answers to this questions?

I would REALLY appreciate some help!
dbomestar
 
Posts: 3
Joined: Fri Jul 25, 2008 12:32 pm

Postby richardk » Fri Jul 25, 2008 3:22 pm

What is causing the current redirect?
If you disable the redirect, to the domains go to the same place?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby dbomestar » Fri Jul 25, 2008 4:20 pm

I've put the nameservers of my hosting in the domain manager (at godaddy) and parked domain in cpanel and set to redirect to subfolder. When I remove redirect it shows URL of domain1 but it's displayed some default cPanel page with message "Great Success ! Apache is working on your cPanel® and WHM™ Server."

Update: I wasn't quite correct. I got that message when I remove "parking" in the cPanel. But when it's parked and then I disable redirect than it redirects from domain1 to domain2 but not to subfolder.
dbomestar
 
Posts: 3
Joined: Fri Jul 25, 2008 12:32 pm

Postby richardk » Sat Jul 26, 2008 3:56 am

Try adding the following to domain1.com's document root
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Add missing trailing slashes.
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$ [NC]
RewriteCond %{DOCUMENT_ROOT}/subdir%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$ [NC]
RewriteRule ^(.*)$ /subdir/$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby dbomestar » Sun Jul 27, 2008 6:13 am

But I have only "domain1.com" as a domain, don't have a hosting on it, so I can put this code only at domain2.coms root.

I've tried to add it to domain2.com and it doesn't work. When I add this code it even removes redirection to subfolder so it's parked it redirects to main domain2.com but doesn't redirects to subfolder.

Any other suggestion? Maybe I am doing something wrong? :(
dbomestar
 
Posts: 3
Joined: Fri Jul 25, 2008 12:32 pm

Postby richardk » Tue Jul 29, 2008 11:22 am

Does this mod_rewrite test work?

For this to work, both domains must go to the same directory (that will contain the .htaccess file) on the server when there is no mod_rewrite.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

I'm having the same problem

Postby mythos » Sat Nov 08, 2008 6:27 am

I'm having the same problem, searched on this forum and came across about a dozen threads. I tried different things but nothing worked.

Basically I want to have a single installation of a CMS say at site1.com, and then have my other websites just be directed to sections of site1.com

So I would like:
site2.com to map to site1.com/subject1
site3.com to map to site1.com/subject2

and so on. This way I don't have to install a CMS twenty times, and can manage everything from one installation.

I'm using Mediatemple for hosting, and the CMS I'm using is Frog.

When I played around with it on localhost I got it working perfectly with an htaccess file that looks like this:

Code: Select all
Options +FollowSymLinks
AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /site2/
 
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  # Main URL rewriting.
  RewriteRule ^http://localhost/site2$ http://localhost/site1/index.php?subject-2
  RewriteRule ^(.*)$ http://localhost/site1/index.php?subject-2/$1 [L,QSA]

</IfModule>


On localhost, everything is fine. And the URL in the browser looks the way it's supposed to.

Everything I've tried online has created a URL that shows site1 instead of site2.

Please help if you can.

Thanks!
mythos
 
Posts: 3
Joined: Sat Nov 08, 2008 6:04 am

Postby richardk » Sun Nov 09, 2008 11:44 am

Try
Code: Select all
Options +FollowSymLinks
AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
  RewriteEngine On

  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteCond %{SCRIPT_FILENAME} !-l
  RewriteCond %{HTTP_HOST}/subject-2 ^(www\.)site2\.com/(subject-2)$ [NC,OR]
  RewriteCond %{HTTP_HOST}/subject-3 ^(www\.)site3\.com/(subject-3)$ [NC]
  RewriteRule ^(.*)$ /site1/index.php?%2/$1 [QSA,L]
</IfModule>
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby mythos » Mon Nov 10, 2008 8:46 am

Thanks for the suggestion, richardk. When I tried it, I got a 403 Forbidden error:


Forbidden

You don't have permission to access / on this server.


Can you recommend something? Thanks for the help!
mythos
 
Posts: 3
Joined: Sat Nov 08, 2008 6:04 am

Postby richardk » Mon Nov 10, 2008 2:28 pm

Which URL were you accessing? What path should it have gone to?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Next

Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 20 guests

cron