1

This should be a simple issue but I can't figure this out. I have a webpage running on a machine to access from the local network. I want to redirect the results of scripts run under cgi back to my /var/www/index.html/ file. I tried to place a redirect line in my /etc/apache2/apache2.conf`` that didn't work so I tried an even simpler task:

redirect permanent /var/www/index.html http://www.google.com

And not even this worked.

What am I doing wrong?

I'm running this on an Ubuntu machine.

Edit:

This is added to my error log when I restart the server:

[Sat Jun 16 17:26:36 2012] [notice] caught SIGTERM, shutting down         | * Restarting web server apache2
[Sat Jun 16 17:26:36 2012] [notice] Apache/2.2.22 (Ubuntu) configured -- \|apache2: Could not reliably determine the server's fully qualified domain \
resuming normal operations      

Edit: Solved and a new problem

I have managed to redirect the webpage to google and now I want to do the actual redirect. I have added this to my apache2.conf file

Redirect permanent /cgi-bin/file.cgi /index.html

And removed the previous file. The file now is redirected to google and not back to my home file...

What's going on?

Yotam
  • 10,295
  • 30
  • 88
  • 128

2 Answers2

2

As far as I know the redirect is not based on a 'file' but on an URL.

So in your case you should try:

Redirect permanent /index.html http://www.google.com

See the apache docs for more information: http://httpd.apache.org/docs/2.0/mod/mod_alias.html#Redirect

You could also try mod_rewrite, but keep in mind it works on incoming requests/URLs not on files on the filesystem.

ps. Make sure you reload you configuration after your changes.

Jeroen
  • 3,076
  • 1
  • 17
  • 16
  • Thanks. I tried this and it worked. But now I have a new problem. I'll post this in the edit – Yotam Jun 16 '12 at 14:44
1

Using .htaccess:

RewriteCond %{REQUEST_URI} ^/?index\.html$
RewriteRule .* http://www.google.com [R=301,L]
Ωmega
  • 42,614
  • 34
  • 134
  • 203