You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Rob Wilkerson <r....@gmail.com> on 2007/08/01 01:44:16 UTC

[users@httpd] Redirecting All Traffic to Homepage

A customer of mine has a website for an annual event that just ended.
She's asking me to effectively disable all pages other than the index
page.  Rather than find and rename each one or some other such hack,
I'd rather create a simple redirect in an .htaccess file but I haven't
been successful with anything I've tried so far.  I'm hoping someone
here can help.

I'd like to redirect any page request to /index.html except, of
course, for requests to /index.html.  Everything I've tried seems to
ignore that last requirement and throw me into an infinite loop.  I've
tried the Rewrite & RewriteMatch directives so far.  I'd like to avoid
the overhead of mod_rewrite, but will go that way if it's my only
option.

Any help would be much appreciated.

Rob Wilkerson

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Redirecting All Traffic to Homepage

Posted by Vincent Bray <no...@gmail.com>.
On 01/08/07, Rob Wilkerson <r....@gmail.com> wrote:
> A customer of mine has a website for an annual event that just ended.
> She's asking me to effectively disable all pages other than the index
> page.  Rather than find and rename each one or some other such hack,
> I'd rather create a simple redirect in an .htaccess file but I haven't
> been successful with anything I've tried so far.  I'm hoping someone
> here can help.

Depending on what you mean by redirect (usually it means sending a 3xx
response so the client requests the new address), try something like:

# Won't send a redirect, transparent to the client.
AliasMatch .* /full/path/to/index.html

# Will send a redirect
RedirectMatch permanent ^/.+ /

See:
http://wiki.apache.org/httpd/WhenNotToUseRewrite

-- 
noodl

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Redirecting All Traffic to Homepage

Posted by Graham Frank <gf...@neoservers.com>.
Note: The overhead for a rule like this is minimal at best.  I've used rules
like this in the past on very active websites with no noticeable impact on
the systems load.

----
Graham Frank
Neoservers LLC - Founder and Owner
Ph: (608) 359-1593
Member of the Better Business Bureau   


-----Original Message-----
From: Graham Frank [mailto:gfrank@neoservers.com] 
Sent: Tuesday, July 31, 2007 6:54 PM
To: users@httpd.apache.org
Subject: RE: [users@httpd] Redirecting All Traffic to Homepage

Hey, 

Try this in .htaccess:

RewriteEngine on
RewriteRule ^.*$ index.html

Basically, anything and everything will land them on index.html.

----
Graham Frank
Neoservers LLC - Founder and Owner
Ph: (608) 359-1593
Member of the Better Business Bureau   


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Redirecting All Traffic to Homepage

Posted by Graham Frank <gf...@neoservers.com>.
Hey, 

Try this in .htaccess:

RewriteEngine on
RewriteRule ^.*$ index.html

Basically, anything and everything will land them on index.html.

----
Graham Frank
Neoservers LLC - Founder and Owner
Ph: (608) 359-1593
Member of the Better Business Bureau   


-----Original Message-----
From: Rob Wilkerson [mailto:r.d.wilkerson@gmail.com] 
Sent: Tuesday, July 31, 2007 6:44 PM
To: ML : Apache
Subject: [users@httpd] Redirecting All Traffic to Homepage

A customer of mine has a website for an annual event that just ended.
She's asking me to effectively disable all pages other than the index
page.  Rather than find and rename each one or some other such hack,
I'd rather create a simple redirect in an .htaccess file but I haven't
been successful with anything I've tried so far.  I'm hoping someone
here can help.

I'd like to redirect any page request to /index.html except, of
course, for requests to /index.html.  Everything I've tried seems to
ignore that last requirement and throw me into an infinite loop.  I've
tried the Rewrite & RewriteMatch directives so far.  I'd like to avoid
the overhead of mod_rewrite, but will go that way if it's my only
option.

Any help would be much appreciated.

Rob Wilkerson

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org