LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-26-2004, 12:10 AM   #1
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Rep: Reputation: 15
simple question


If my website is http://www.mysite.com/web/public_html/index.php

How can I change this so instead of showing http://www.mysite.com/web/public_html/ in the address bar, it just shows http://www.mysite.com/


I would guess this is done in the httpd.conf file?

Thanks.
 
Old 01-26-2004, 12:19 AM   #2
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Rep: Reputation: 36
Yes you are right httpd.conf

Search for Document Root:

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/any path/to your/web files"

put the index file in there
 
Old 01-26-2004, 12:25 AM   #3
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
well, im using a portal system so it would be more difficult than just moving my index.php. I will look into symbolic links and aliases.
 
Old 01-26-2004, 01:32 AM   #4
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Rep: Reputation: 36
Sorry, I didn't mean to say move your index.php
Change the path to point to where you already have it.

Won't this work for you?
 
Old 01-26-2004, 08:39 AM   #5
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
the path is already set to where the index.php file is.

The index file is in www.mysite.com/web/public_html/index.php

My document root is pointed to /home/mysite/public_html/web/public_html

I see sites using the same portal with just www.mysite.com and not displaying the /web/public_html/index.php at the end.

So i was looking for a way for the url address bar to display:

www.mysite.com instead of www.mysite.com/web/public_html/

Right now if someone types in www.mysite.com, I have to use an index.html file to redirect them to my index.php file.
 
Old 01-26-2004, 04:15 PM   #6
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Rep: Reputation: 36
Did you add index.php to the Directory Index?

Add index.php in
IfModule mod_dir.c under DirectoryIndex.

Apache will then look for index.php in the DocumentRoot
and will display it as its main page.
 
Old 01-26-2004, 06:39 PM   #7
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
<IfModule mod_dir.c>
DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml index.htm default.htm default.html home.htm
</IfModule>


Thanks for helping but I guess you are missing the question. I understand that I can type www.mysite.com/web/public_html/ and it will find the index.php file but you would think there would be a way that even though index.php is under <document_root>/web/public_html, that the browser address would just display www.mysite.com/ but really it is pointing to www.mysite.com/web/public_html/index.php.

What Im looking for is a way to invisibly tell the browser if I type in www.mysite.com to automatically pull www.mysite.com/web/public_html/index.php but only display www.mysite.com in the address bar.
 
Old 01-26-2004, 06:58 PM   #8
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Rep: Reputation: 36
OK Duh. I get it. (I think)
You could create a sym link to the web/public_html directory

cd /whatever
ln -s /whatever/web/public_html/ .

The contents of web/public_html/ will be available from /whatever

How's that


Last edited by alar; 01-26-2004 at 07:17 PM.
 
Old 01-26-2004, 07:47 PM   #9
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
I've been reading some on symlinks and it looks like the answer to my problem. My full path is /home/username/public_html/web/public_html/index.php

This is what I did in SSH.

cd /home/username/public_html
ln -s /home/username/public_html/web/public_html/

And I get this error:

ln: './public_html: cannot overwrite directory

Can you make more clear what to type with the above path?

Thanks again.
 
Old 01-26-2004, 07:58 PM   #10
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Rep: Reputation: 36
The elusive '. 'at the end.
Represents current directory

you could type it out in whole
ln -s /home/username/public_html/web/public_html/ /home/username/public_html/

But you prolly have to change your document root as well won't you?
I'm confused again ;z

Last edited by alar; 01-26-2004 at 08:02 PM.
 
Old 01-26-2004, 08:02 PM   #11
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
hmm similiar error.

ln: '/home/username/public_html/ /public_html' : cannot overwrite directory

You think your confused
 
Old 01-26-2004, 08:19 PM   #12
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Rep: Reputation: 36
Ahh it doesn't like the same name. public_html

ln -s /home/username/public_html/web/public_html/ /what's inDocumentRoot/

ln -s TARGET [LINK_NAME]

What is your DocumentRoot set to?
if it's /home/username/public_html/web/public_html/ there shouldn't be a problem (!?)

You can essentially point any files to be accessible from what is in document root.
Or, you can point DocumentRoot to look anywhere for the files.

One of my httpd.conf's reads from
DocumentRoot "/aar/Gonna_be_Web_Stuff/Linux"

my index file is in Linux

If I change my mind I can set up another apache in
/usr/local/NewApache - and put that in my document root

and still access the old stuff with

ln -s /aar/Gonna_be_Web_Stuff/Linux /usr/local/NewApache

all my old web files now appear in /usr/local/NewApache

Hope this helps
alar

or:

Quote:
even though index.php is under <document_root>/web/public_html
Change document root to <document_root>/web/public_html


Last edited by alar; 01-26-2004 at 08:34 PM.
 
Old 01-26-2004, 08:27 PM   #13
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
I will play around with it. Thanks for your help.
 
Old 01-26-2004, 08:31 PM   #14
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Rep: Reputation: 36
So much for simple questions eh?
Bwahahaha!
 
Old 01-26-2004, 08:41 PM   #15
vadertech
Member
 
Registered: Nov 2002
Posts: 67

Original Poster
Rep: Reputation: 15
lol, we learn by breaking things.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu Fluxbox simple question, simple answer? generallimptoes Linux - Software 3 09-26-2005 03:03 PM
Installing Programs - A simple question from my simple mind jmp875 Linux - Newbie 6 02-18-2004 10:03 PM
Hopefully a Simple Question Arcane Kidd Linux - Newbie 5 01-17-2003 05:27 PM
Really Simple Question -- Please help! Cia420 Linux - General 3 05-07-2002 07:42 AM
simple question seeking simple answer enzo250gto Linux - Newbie 1 10-27-2001 05:08 AM


All times are GMT -5. The time now is 02:21 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration