PDA

View Full Version : need help with 301 redirect


jfrovich
11-11-2006, 22:10/10:10PM
Im trying to redirect
supportcave.com/help
to
supportcave.com/fourm

Here is my current .htaccess file
Im currently redirecting
help.supportcave.com to supportcave.com/forum
But i cant get the supportcave.com/help/ to work

RewriteEngine on

RewriteCond %{HTTP_HOST} ^help.supportcave.com [NC]
RewriteRule ^(.*)$ http://www.supportcave.com/forum/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^help.supportcave.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.help.supportcave.com$
RewriteRule ^(.*)$ http://www.supportcave.com/forum/$1 [R=301,L]

RewriteRule ^/help(.*) /http://www.supportcave.com/forum/$1 [R=301]

How can i do this.

WebSavvy
11-11-2006, 23:03/11:03PM
Jas, you're rules are redirecting
help.supportcave.com

not ...
supportcave.com/help/

RewriteCond %{HTTP_HOST} ^supportcave.com/help/ [NC]
RewriteRule ^(.*)$ http://www.supportcave.com/forum/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^supportcave.com/help/$ [OR]
RewriteCond %{HTTP_HOST} ^www.help.supportcave.com$
RewriteRule ^(.*)$ http://www.supportcave.com/forum/$1 [R=301,L]

Try that above ...

I don't have access to test this anywhere at the moment as I'm traveling right now.

jfrovich
12-11-2006, 00:30/12:30AM
HI Deb
that redirects to
http://www.supportcave.com/help/showthread.php?t=5327

I need both to work..
it should go to
http://www.supportcave.com/forum/showthread.php?t=5327

thanks for trying
ill wait.

http://www.supportcave.com/help/
wont redirect at all

WebSavvy
12-11-2006, 04:10/04:10AM
Jas, do you have an index file on that /help/ folder?

If so, is it in PHP?

If so, you can redirect right inside the file itself like this:


<?php
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.dom.com/folder/" );
?>

Replace http://www.dom.com/folder/
with the actual URL you want to redirect to.

This is the "easy way" to do 301 redirects using PHP instead of messing with .htaccess

jfrovich
12-11-2006, 08:54/08:54AM
THanks
Added that php file
now how do i redirect the old posts
in the php file?
http://www.supportcave.com/help/showthread.php?t=3088

JEHochman
12-11-2006, 11:03/11:03AM
RewriteRule ^/help(.*) /http://www.supportcave.com/forum/$1 [R=301]

Change the above to


RewriteRule /help/(.*) http://www.supportcave.com/forum/$1 [R=301]


Let me know if that works.

jfrovich
12-11-2006, 11:27/11:27AM
nope
to make sure its NOT just my pc's issue

try this google search and scroll down
and cleck the supportcave.com/help

http://www.google.com/search?hl=en&lr=&q=site%3Awww.supportcave.com%2F&btnG=Search

I want to make sure its not just my pc

g1smd
12-11-2006, 15:05/03:05PM
If you have a redirect for a single folder, then that redirect always needs to be placed first in the .htaccess code.

Get that out the way before you use the next redirect to catch all of the other URLs that the first one did not do.

JEHochman
12-11-2006, 17:06/05:06PM
Sorry, try this instead:

Redirectmatch 301 /help/(.*) http://www.supportcave.com/forum/$1

And yes, put it in the front.

jfrovich
12-11-2006, 17:22/05:22PM
Originally posted by g1smd
If you have a redirect for a single folder, then that redirect always needs to be placed first in the .htaccess code.

Get that out the way before you use the next redirect to catch all of the other URLs that the first one did not do.

Do you mean in the root .htaccess files or the /help/ .htaccess file

JEHochman
ill try when i get home in a few hrs
thanks