LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I create a website alias in Apache? (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-create-a-website-alias-in-apache-612899/)

Sysop1911 01-11-2008 12:19 PM

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

acid_kewpie 01-11-2008 01:01 PM

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


Sysop1911 01-13-2008 03:29 PM

Quote:

Originally Posted by acid_kewpie (Post 3019257)
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.

farslayer 01-13-2008 09:01 PM

for apache you Could look at mod_alias or mod_rewrite. Might be kind of overkill for only a couple pages as stated earlier..

Sysop1911 01-14-2008 07:34 AM

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'?

acid_kewpie 01-14-2008 08:54 AM

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??

Sysop1911 01-14-2008 11:47 AM

Quote:

Originally Posted by acid_kewpie (Post 3021977)
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.

Sysop1911 01-17-2008 07:27 AM

Quote:

Originally Posted by acid_kewpie (Post 3019257)
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.

acid_kewpie 01-17-2008 07:43 AM

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.


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