LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how do i do this with apache? (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-do-this-with-apache-155262/)

veritas 03-09-2004 12:15 AM

how do i do this with apache?
 
Hi, im using apache version 1.3 and i need to know how to do something.

I am trying to redirect users that come to the site to the /var/www/htdocs/modules/news. I tried the option DocumentRoot, but the problem with that is it wont let the files in modules/news use things lower than the modules folder, so basically it wont work like that.

Is there an option to just link them to that when visitors go to the root of the website instead of actually setting that as the root?

urzumph 03-09-2004 03:59 AM

depending on what "/var/www/htdocs/modules/news" is, this may or may not work.

You can simply sym-link index.html in your DocumentRoot directory to the news page you want to use. However this could cause some problems, especially if what you have in news is a PHP / other script. Another complication is if /var/www/index.html actually exists and is a valid page you want to visit. If it's a valid page, then the best I can recommend is something like page-redirection based on referrer fields, but that could come un-stuck if people turn it off for privacy reasons. (sorry, I can't give advice on that, I have never learnt HTML/JS)

to sym-link :

ln -s /var/www/htdocs/modules/news/index.html /var/www/index.html

(I think those are in the right order lol)

Satriani 03-09-2004 07:29 AM

You could also put a simple index.html in your docroot containing:
Code:

<HTML>
 <META HTTP-EQUIV=Refresh CONTENT="0; URL=/modules/news">

 <SCRIPT LANGUAGE="JavaScript">

 function reDirect() {
    document.location='/modules/news/whatever.html';
  }

 </SCRIPT>

 <BODY onload='reDirect()';>
 </BODY>
</HTML>

This will definitively redirect the user... If META tag is misunderstood, it will start the JavaScript function... If it goes wrong now, well they have a serious problem... You might want to add a text in the body with something like: Redirecting you, if not working, <a href="your-url">click here</a. ... Just to make your visitors have the possibility to escape...


All times are GMT -5. The time now is 12:48 AM.