Apache Server configuration support - Redirecting certain files in htaccess

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > January 2007 > Redirecting certain files in htaccess





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Redirecting certain files in htaccess
Nospam

2007-01-06, 8:11 pm

What do I need to add to htaccess to redirect certain files containing abc
in the filename to another page, eg:

RedirectMatch permanent ^(.*)abc\.html$ http://www.example.com/redirect.html

would this redirect say http://www.example.com/abc23.html to
http://www.example.com/redirect.html

?


shimmyshack

2007-01-06, 8:11 pm


Nospam wrote:
> What do I need to add to htaccess to redirect certain files containing abc
> in the filename to another page, eg:
>
> RedirectMatch permanent ^(.*)abc\.html$ http://www.example.com/redirect.html
>
> would this redirect say http://www.example.com/abc23.html to
> http://www.example.com/redirect.html
>
> ?



and of course you need the control file to be called
.htaccess which is done in by default int he httpd.conf like so:
AccessFileName .htaccess


you also need to make sure .htaccess files are in operation
make sure this line is *not* in the httpd.conf
AllowOverride None

and that you can do the redirects at all which depends on mod_alias in
apache 2 liek so:
LoadModule alias_module modules/mod_alias.so


you dont need to specify the start of the string.
this would work:

RedirectMatch permanent abc\.html$ http://www.example.com/redirect.html


as this matches the end of the URI whatever the start.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com