Is there a way to redirect all traffic to my website to a specific page? My free host does support PHP. Not sure if that is what would be appropriate for this or not. Thank you.
+1
A:
If your host is based on Apache and supports mod_rewrite, use that. Eg. the wordpress typical rewite, that redirects requests to non-existing files/folders to index.php, passing on the original URL:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Remus Rusanu
2009-10-28 00:31:29
A:
I'm not sure but meta refresh might work for you
<META http-equiv="refresh" content="0;URL=http://some-url.com/some-page.html">
FrustratedWithFormsDesigner
2009-10-28 00:41:49
A:
If you can't use .htaccess or mod_rewrite is not available, you can use a simple PHP file:
index.php
<?php
header("Location: http://www.example.com/page");
?>
Peter Sankauskas
2009-10-28 00:55:02
+1
A:
If your host runs Apache and supports .htaccess, add this line to your .htaccess file
ErrorDocument 404 /index.htm
It does not require mod_rewrite. It does assume that only files that are not found will redirect to index.htm.
bmb
2009-10-28 01:11:16
But wouldn't this return the result 404 with content /index.html ? If the request is made by an application, the 404 will be considered an error.
Remus Rusanu
2009-10-28 01:45:41