Forum Moderators: phranque

Message Too Old, No Replies

Need to 301 one webpage to another via htaccess

This is NOT a non-www Vs www issue, but two distinct URL's

         

Clint

3:46 pm on Jun 13, 2005 (gmt 0)



Hi all, can anyone please tell me how to 301 via htaccess domain.com/page-name.html to
domain.com/other-page-name.html
?

If it matters, I already have this in my htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301]

Thanks.

[edited by: jdMorgan at 5:13 pm (utc) on Aug. 12, 2005]
[edit reason] Corrected code formatting. [/edit]

Dapuzz

6:26 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



why not
RedirectPermanent /page-name [mydomain.com...]
or
Redirect 301 /page-name [mydomain.com...]

[httpd.apache.org...]

Clint

12:00 pm on Jun 14, 2005 (gmt 0)



Thanks, but I guess I should have mentioned that I don't know anything about this sort of thing. ;) Do I simply just paste one of the lines you put above into my htaccess file?

Clint

3:32 pm on Jun 14, 2005 (gmt 0)



Ok, I tried this anyway and it worked. Can anyone please verify that this is the correct and best thing to do?

RedirectPermanent /directed-page.html [MyDomain.com...]

I did a header check of /directed-page.html and it shows "HTTP/1.1 301 Moved Permanently". Is what I did better than:

Redirect 301 /page-name [mydomain.com...]

or is that method above better?
Thanks.

g1smd

8:58 pm on Jun 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



They do the same thing.

The important point is that it is a 301 redirect, that is, it is a Permanent Redirect.

It must NOT be a 302 redirect.

Clint

11:54 am on Jun 16, 2005 (gmt 0)



Thanks a bunch. :)

jcmiras

1:55 am on Jul 5, 2005 (gmt 0)

10+ Year Member



Hey, when i use that redirect on one of my page,
redirect 301 /page.htm [domain.org...]

the resulting URL becomes
[domain.org...]

what i am expecting is
[domain.org...]

How can i remove the "?"?

Thanks

Marcia

2:05 am on Jul 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Be careful!

[MyDomain.com...]

and

[mydomain.com...] (no file extension here)

are not the same thing. One is a page name with the .html file extension, the other indicates that it's the root level page of a sub-directory or a page with no file extension. You don't want to confuse bots, be precise and put exactly what the page is.

jcmiras

2:50 am on Jul 5, 2005 (gmt 0)

10+ Year Member



Yah. i know that. So how can i remove the "?" in the "newpage". "newpage" doesnt have an extension.