LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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
  Search this Thread
Old 01-11-2008, 12:19 PM   #1
Sysop1911
Member
 
Registered: Dec 2007
Posts: 30

Rep: Reputation: 15
How do I create a website alias in Apache?


I have a URL that a lot of people need to get to on my website, but it is really long (i.e., "http://www.blah.com/blahbalk/kajsdlfja/asdafs/qwer/blah.etc - you get the idea). I want to take that URL and create an alias so if I type in 'http://www.blah.com/blah2' it will take me to the long website listed above. How do I do this? I'm pretty sure I just have to edit some stuff in httpd.conf. I did a search on this site and on the web but can't really come up with what I need. And 'yes', I'm a Linux newbie. Thanks.

Sysop1911
 
Old 01-11-2008, 01:01 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
if you just want one file to point to somewhere else, then i'd say avoid direct apache modifications... it seems like it's just the wrong scope you'd be working in. entire sites, yes change apache, but for a single file, sort it at a file level i'd say... just create a simple html file containing a 302 meta refresh...

Code:
<HTML>
<HEAD>
<META HTTP-EQUIV="refresh" content="2;URL="http://www.blah.com/blahbalk/kajsdlfja/asdafs/qwer/blah.etc">
<TITLE>Redirecting</TITLE>
</HEAD>
<BODY>
Redirecting you to that funky file...
</BODY>
</HTML
 
Old 01-13-2008, 03:29 PM   #3
Sysop1911
Member
 
Registered: Dec 2007
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by acid_kewpie View Post
if you just want one file to point to somewhere else, then i'd say avoid direct apache modifications... it seems like it's just the wrong scope you'd be working in. entire sites, yes change apache, but for a single file, sort it at a file level i'd say... just create a simple html file containing a 302 meta refresh...

Code:
<HTML>
<HEAD>
<META HTTP-EQUIV="refresh" content="2;URL="http://www.blah.com/blahbalk/kajsdlfja/asdafs/qwer/blah.etc">
<TITLE>Redirecting</TITLE>
</HEAD>
<BODY>
Redirecting you to that funky file...
</BODY>
</HTML
Can you give me a little more detail? The site that is going to be redirected will have many pages, so it's not just one page that's being directed. Thanks.
 
Old 01-13-2008, 09:01 PM   #4
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
for apache you Could look at mod_alias or mod_rewrite. Might be kind of overkill for only a couple pages as stated earlier..
 
Old 01-14-2008, 07:34 AM   #5
Sysop1911
Member
 
Registered: Dec 2007
Posts: 30

Original Poster
Rep: Reputation: 15
Just to give a bit more detail. The site that we want to alias has many pages. The main page has 9 internal links and each of those links have many other internal links, so we're looking at about 50 pages or so that make up the site.

For one thing, the main site that we want to alias is already a sub-site of another site. So the website is like http://www.blah.com, but the site we want to re-direct's main page is like 'http://www.blah.com/career_managemnent/intern_program'. There are 9 links on this page and then many other links below that. Is aliasing even convenient? Would I have to re-direct each link after 'intern_program'?
 
Old 01-14-2008, 08:54 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
right ok, your intital example read like it was just one common file. ok, so contrary to the above, an alias command would probably be what you want if it's actually just lower down in the site (not sure i really see a motivation for the entire side myself, user clicks a link which just happens to have a long url... so what?) so in the virtualhost or such, "alias /shortsite /var/www/html/1/2/3/4/5/". note that the second path is a filesystem path though, not a relative web page. also could you not just do a symlink outside of apache altogether??

Last edited by acid_kewpie; 01-14-2008 at 08:58 AM.
 
Old 01-14-2008, 11:47 AM   #7
Sysop1911
Member
 
Registered: Dec 2007
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by acid_kewpie View Post
right ok, your intital example read like it was just one common file. ok, so contrary to the above, an alias command would probably be what you want if it's actually just lower down in the site (not sure i really see a motivation for the entire side myself, user clicks a link which just happens to have a long url... so what?) so in the virtualhost or such, "alias /shortsite /var/www/html/1/2/3/4/5/". note that the second path is a filesystem path though, not a relative web page. also could you not just do a symlink outside of apache altogether??
Hey, Acid_kewpie, I really appreciate the help you're trying to give me, but I am a newbie with Linux and webhosting stuff in general, so I am having some trouble understanding your post.

I see what you're saying about why alias the entire site and instead just do the main page. That's a good point, so what I'll probably do is alias the first page and then see how that goes and then make any changes later if need be.

We are running Apache 1.something, MySQL, PHP and ez publish software on a Windows 2000 Server box. Where exactly would I put that
"alias /shortsite /var/www/html/1/2/3/4/5/" line? What file would I edit? And what do you mean by "do a symlink outside of apache altogether"? Thanks.
 
Old 01-17-2008, 07:27 AM   #8
Sysop1911
Member
 
Registered: Dec 2007
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by acid_kewpie View Post
if you just want one file to point to somewhere else, then i'd say avoid direct apache modifications... it seems like it's just the wrong scope you'd be working in. entire sites, yes change apache, but for a single file, sort it at a file level i'd say... just create a simple html file containing a 302 meta refresh...

Code:
<HTML>
<HEAD>
<META HTTP-EQUIV="refresh" content="2;URL="http://www.blah.com/blahbalk/kajsdlfja/asdafs/qwer/blah.etc">
<TITLE>Redirecting</TITLE>
</HEAD>
<BODY>
Redirecting you to that funky file...
</BODY>
</HTML
Acid,

I found out that, in fact, it is only one page that needs to be redirected. So just to be sure, I'd write an HTML file that looks like this:

Code:
<HTML>
<HEAD>
<META HTTP-EQUIV="refresh" content="2;URL="http://www.blah.com/blahbalk/kajsdlfja/asdafs/qwer/blah.etc">
<TITLE>Redirecting</TITLE>
</HEAD>
<BODY>
Redirecting you to that funky file...  <- what exactly do I put here?
</BODY>
</HTML
[/QUOTE]

And where do I put this html file once it's created? Thanks.
 
Old 01-17-2008, 07:43 AM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you put that file wherever you want, just somewhere reachable over apache like any other web file. as for the body, whatever you want, just a message to the end user. you could reduce the timeout from 2 to 0 to redirect instantly too.
 
  


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
create alias on apache 1.3 ALInux Linux - Networking 2 04-01-2006 03:20 AM
Create alias in MySQL? JockVSJock Slackware 2 02-23-2006 09:15 PM
how to create an alias (apache) to point to a cd-rom/dvd verlossen Linux - Networking 1 11-20-2005 03:50 PM
create alias ohade Mandriva 1 08-09-2005 04:12 PM
create alias for root powah SUSE / openSUSE 1 04-25-2005 12:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:13 AM.

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
Open Source Consulting | Domain Registration