GIDForums  

Go Back   GIDForums > Web Hosting Forums > Apache Web Server Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-Nov-2003, 09:36
kardon kardon is offline
New Member
 
Join Date: Nov 2003
Posts: 2
kardon is an unknown quantity at this point

Hostname Rewrite


I'm having some difficulty with rewriting a domain name to another domain.

For example, I want any request to oldsite.mydomain.com to go to newsite.mydomain.com

Both oldsite.mydomain.com and newsite.mydomain.com reside on the same server (same apache process actually) but I want to drop oldsite and stick it under a directory on newsite.

I'm choosing a rewrite over an alias because I still want requests such as: oldsite.mydomain.com to go to: newsite.mydomain.com

Here's what I have been tinkering with... forgive me if I am butchering the rewrite syntax:

RewriteCond %{HTTP_HOST} !^oldsite\.mydomain\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) newsite.mydomain.com$1 [L,R]


Thanks in advance for any help!
  #2  
Old 18-Nov-2003, 10:12
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hello kardon,

Sorry that I cannot post a complete example for your situation but I am having serious problems staying connected to the Net today.... these incompetent, lazy, horrible Malaysian ISPs!!!

http://www.desilva.biz/forum/viewtopic617.php <-- is what you could use... of course this .htaccess file goes inside the WWW root of the subdomain, oldsite.example.com.
  #3  
Old 18-Nov-2003, 11:22
kardon kardon is offline
New Member
 
Join Date: Nov 2003
Posts: 2
kardon is an unknown quantity at this point
Thanks for the help J. I didn't quite get it working yet. I stuck the .htaccess file in the virtual host document root but am getting a 403 error (which is normal b/c I have directory indexing shut off) but I would have thought it wouldn't try to read anything in the directory, just do the redirect.

Is there any way to not have to do this via an htaccess file? That means I'll have to leave the virtual host entry in apache and a directory to hold the .htaccess file. I'd really like to have 1 section within my httpd.conf file that has all these redirects (I actually have about 10 of these to do (oldsite.domain.com => newsite.domain.com/oldsite/).

Thanks.
  #4  
Old 19-Nov-2003, 08:41
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
It comes as no surprise that you didn't get it working... my reply yesterday was done under 'duress' Anyway, today, things look a lot better....

On topic:

What happens when someone goes to the following 3 urls?
1. http://new.example.com/old/
2. http://example.com/new/old/
3. http://www.example.com/new/old/

Are they ending up at the same place?
 
 

Recent GIDBlogA Week in Kuwait by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need rewrite help for cgi script Shop cart theblade24 Apache Web Server Forum 18 26-Jan-2004 05:23
Domain to hostname script req. encoderX MySQL / PHP Forum 3 20-Dec-2003 18:58
.htaccess language / rewrite problem spinflip Apache Web Server Forum 5 15-Dec-2003 14:14
rewrite in Apache2 lordklloyd Apache Web Server Forum 2 17-Nov-2003 06:20
Rewrite urls for Mambo jrobbio MySQL / PHP Forum 16 24-Jul-2003 03:47

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:17.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.