apache2 redirect

Hi,

I have an openSUSE setup with apache2 running as webserver. DocumentRoot is in /srv/www/htdocs where an index.html file is placed - everything is default. Instead of displaying the index.html content I want to redirect to a script located in /srv/www/cgi-bin. For this purpose I have used http-equiv meta tag in the index.html file. After restart of the server I have tried to access the server directly from its IP but it does not redirect. Furthermore, any changes to the index.html is not shown when accessing the server. However, if I put an alias in my /etc/hosts file on my local machine and connect to the server via alias the redirect works fine. Could anyone shed some light on what is going on?

Best regards,
Thomas

Post what you see in your /var/log/apache2/access_log and
/var/log/apache2/error_log files when this happens. Assuming the browser
is getting the index.html, and assuming that the HTTP meta redirect is
setup correctly (post it), and assuming that the redirect goes to
somewhere the client can access (perhaps this is why modifying /etc/hosts
helps), things in /etc/hosts shouldn’t affect a client redirecting.

Good luck.

On general principles, you should always post your code. Sometimes the concept is correct but the execution is faulty.

In your particular case, I suspect

  • Name resolution based on FQDN, which in some configurations is interface-specific so might work for one (eg localhost, or localhost might just work as a default) but not another (eg the LAN interface)

But, without details nothing can be confirmed and all is speculation at this point.

TSU