Page 1 of 1

question_ redirecting unsuccessful requests with htaccess

Posted: Wed Feb 27, 2008 2:24 pm
by pedrotuga
I am in the process of making major changes in a website. A lot of the content will be taken away, but i stll want to get all the visitors from google.

I have a forum in http://mysite.com/forum
But now I am taking it away and I want to redirect all those users to:
http://mysite.com/news.htm

would something like this be ok?

^/forum/(.*)(.htm|/|.php) /news.htm #.htm .php and / are the only possibilities for my forum's urls.

Also, don't know which chars to escape in htaccess regex...

Like... is this necessary?...

^/forum/(.*)(\.htm|\/|\.php) /news.htm

What about this?

^/forum/(.*) /news.htm

Is it dangerous in any way? why? how?

thanks in advance

Re: question_ redirecting unsuccessful requests with htaccess

Posted: Tue Apr 01, 2008 9:09 am
by samb0057
Just make an index file in the forum/ directory with the following code:

<?php
header('Location: http://www.mysite.com/whatever/');

Re: question_ redirecting unsuccessful requests with htaccess

Posted: Tue Apr 08, 2008 9:46 am
by pickle
samb0057 wrote:Just make an index file in the forum/ directory with the following code:

<?php
header('Location: http://www.mysite.com/whatever/');
Um... no that won't work unless someone requests either no file or index.php. If someone requests blah.php, they'll still get a 404 error....

...Which is exactly what you should be looking into ~pedrotuga. Do a Google search for something along the lines of 404 .htaccess redirect