TomEA
asked on
How can I get Apache to serve a generic page for any URL entered?
Hello!
I have an Apache 2.2 web server running on Ubuntu 9.10 server. I need to configure it so that any URL that is given to it will be responded to with the same generic page. In other words, say our domain is sample.com, I would need it to respond to URL's such as:
http://www.sample.com/page.html
http://www.sample.com/whatever/page.cfm?stuff=yes
http://www.sample.com/another/page/index.php
But I would need it to respond to all of those by going to the same generic page. The purpose here is to create a downtime notice that will be displayed regardless of the link that the user has clicked on.
Can anyone tell me what I'd have to put in the conf file to accomplish that?
Thanks!
- Tom
I have an Apache 2.2 web server running on Ubuntu 9.10 server. I need to configure it so that any URL that is given to it will be responded to with the same generic page. In other words, say our domain is sample.com, I would need it to respond to URL's such as:
http://www.sample.com/page.html
http://www.sample.com/whatever/page.cfm?stuff=yes
http://www.sample.com/another/page/index.php
But I would need it to respond to all of those by going to the same generic page. The purpose here is to create a downtime notice that will be displayed regardless of the link that the user has clicked on.
Can anyone tell me what I'd have to put in the conf file to accomplish that?
Thanks!
- Tom
ASKER
Thanks!
That looks like the solution. However, it appears that the rewrite module is not currently enabled. I'm used to dealing with Apache on Windows, not Linux, and am not sure how to enable it. Modules don't seem to be loaded from the apache2.conf file on this version.
Any pointers?
Thanks!
- Tom
That looks like the solution. However, it appears that the rewrite module is not currently enabled. I'm used to dealing with Apache on Windows, not Linux, and am not sure how to enable it. Modules don't seem to be loaded from the apache2.conf file on this version.
Any pointers?
Thanks!
- Tom
ASKER
I have verified that the rewrite module is loading successfully, and I've copied and pasted the rewrite code exactly (except for changing the URL) to an .htaccess file in the server's default directory. But everything is still coming up with a 404 Not Found error. Not sure what I'm doing wrong.
ASKER
By default directory, I mean /var/www, where index.html lives.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Where in the Apache configuration should that RedirectMatch line go?
You can add it before the last </virtual host> tag in your /etc/apache2/sites-enabled /000-defau lt file
If you a virtual host you can add it der else you can add it at the end of httpd.conf file.
With an .htaccess :
Open in new window