LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 08-27-2007, 04:24 PM   #1
riluve
Member
 
Registered: Nov 2004
Distribution: CentOS-4
Posts: 142

Rep: Reputation: 15
Apache URLS


Sorry to start another thread on this, but I have googled the web and searched the forums to no avail. There is something simple I am missing and I can’t figure it out. I appeal to your sense of humanity to knock me in the head so I can fix this thing.

Here is the root problem. When visitors come to any of my sites, they get a URL similar to the following:
http://xxx.xxx.xxx.xxx/dir/filename.ext

Obviously what I want them to see is:
http://domainName.com

I think the problem originates in that I want to host many sites/domains from a single server and a single instance of Apache. Obviously then, each website is in its own sub-directory off the document root page.

I am using godaddy.com as my DNS and their names servers, but everything else is local on my own machine (CENTOS). Their "masking" option for URL's seems rather rudimentary and "hackish" and at either rate, it causes some other issues.

So I have forwarding on at godaddy.com because it’s the only way I can figure to give them the address of my machine. The forwarding entry takes on the URL form I despise:
http://xxx.xxx.xxx.xxx/dir/filename.ext

So I have turned on mod_rewrite and tried to get it to catch any accesses and re-write them, but that seems “after the fact”. That is, it seems like mod_rewrite is not used to update or fix the URL as presented by godaddy, rather it would just filter that URL and redirect it to a logical place inside the server.

The idea I currently have is to make a single root index page and have it call the websites and then maybe I will have a chance to fix the URL, but that sounds like a hack to me.

Is the a proper way to do this? Am I missing something?
 
Old 08-27-2007, 05:38 PM   #2
nan0meter
Member
 
Registered: Aug 2007
Location: The Netherlands
Distribution: Fedora 7 x86_64
Posts: 119

Rep: Reputation: 15
Do you use virtual domains in your apache configuration? That solves the problem i guess.
 
Old 08-28-2007, 03:24 AM   #3
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 10.04, Crunchbang Statler
Posts: 3,325

Rep: Reputation: 168Reputation: 168
Quote:
Obviously then, each website is in its own sub-directory off the document root page.
And in the virtual hosts you give every user/site its own document root !!
 
Old 08-28-2007, 07:24 AM   #4
riluve
Member
 
Registered: Nov 2004
Distribution: CentOS-4
Posts: 142

Original Poster
Rep: Reputation: 15
Well thanks for trying guys, I really appreciate it, however, I should have mentioned I need to support https on at least one site and that can not be done with a virtual server.

Also, the document root for a virtual server would not help because the URL still comes up ugly in the current document root (with the IP in the address bar).
 
Old 08-29-2007, 08:29 AM   #5
nan0meter
Member
 
Registered: Aug 2007
Location: The Netherlands
Distribution: Fedora 7 x86_64
Posts: 119

Rep: Reputation: 15
Seems to be a DNS problem then? If you configured the DNS yourself then could you show us some information how it is configured?
 
Old 08-29-2007, 02:07 PM   #6
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 10.04, Crunchbang Statler
Posts: 3,325

Rep: Reputation: 168Reputation: 168
For https you need IP based virtual hosts and not name based virtual hosts. Although I have never used the mix, it should be possible (my server only runs https).

Don't know why you get an ip address

If you don't use virtual hosting with separate document roots, one of the things that will be shared between all the sites is session variables (I ran into that problem once when I started).

If you already have setup some sites (even if it's with empty index.html pages or so), can you post the URLs here so we can try them?
 
Old 08-29-2007, 03:46 PM   #7
riluve
Member
 
Registered: Nov 2004
Distribution: CentOS-4
Posts: 142

Original Poster
Rep: Reputation: 15
OK - yes it did turn out to be DNS thing. It turns out godaddy has a place to enter what one might think is an A RECORD, but it is in fact not an A RECORD. This way they can keep the actual A RECORD pointed to their pages with advertising.

So anyway - I tracked down the actual A record and pointed it to my server and bamm - I got the expected behavior. Now I just need to figure out regular expressions.
 
Old 08-30-2007, 06:51 AM   #8
nan0meter
Member
 
Registered: Aug 2007
Location: The Netherlands
Distribution: Fedora 7 x86_64
Posts: 119

Rep: Reputation: 15
Good it worked! There are much tutorials about regular expressions, most of them use Perl regular expressions. You can try regular expressions with regexxer, for example load a log file like /var/log/dmesg or any other file in regexxer and try to figure out how regex works.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
case sensitive URLs with Apache ddaas Linux - Networking 2 08-11-2006 06:32 PM
apache: / at the beginning of relative urls monkeyfoo Linux - Software 1 04-29-2006 11:32 AM
Apache: prevent logging certain URLs ? michaelsanford Linux - Software 1 07-22-2005 07:48 PM
apache proxy server rewrite urls slackwarefan Linux - Software 0 10-19-2004 07:58 PM
apache and urls ferretmanus Linux - Newbie 1 09-16-2003 01:25 PM


All times are GMT -5. The time now is 12:19 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration