Forum Moderators: phranque

Message Too Old, No Replies

Redirecting deleted files to new pages

How do I?

         

textex

2:30 pm on May 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



.htacess currently reads:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Need to implement:
redirect 301
oldpage.htm
http://www.example.com/newpage.htm

How do I do both?

[edited by: jdMorgan at 7:29 pm (utc) on May 19, 2006]
[edit reason] Example.com [/edit]

jdMorgan

7:31 pm on May 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your example would work with just a few changes:

Redirect 301 /oldpage.htm http://www.example.com/newpage.htm

Or you could code the equivalent using mod_rewrite instead of mod_alias.

Jim

textex

7:56 pm on May 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Still not working.

I have removed the page from the server. Will it make a difference in the coding?

jdMorgan

8:25 pm on May 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, the page need not exist.

Did you flush your browser cache? If not, then you'll likely see the previously-cached response for that URL, and no request will be sent to your server. Therefore, the code will never run and can have no effect.

If it's not that, then the 'old URL' is incorrect. I've never heard of an Apache server without mod_alias loaded, so it's not likely to be that Apache doesn't understand a simple Redirect directive.

Jim

textex

8:39 pm on May 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Getting message:
The requested URL /oldpage.htm was not found on this server.

Excuse the example...maybe I am writing it wrong...

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Redirect 301 oldpage.htm http://www.example.com/newpage.htm

[edited by: jdMorgan at 8:47 pm (utc) on May 19, 2006]
[edit reason] Example.com [/edit]

jdMorgan

8:47 pm on May 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You omitted the leading slash. It's required.

Please use example.com *only* -- You are creating live links to a real site by using "mysite" or "site.com", and I must edit them. That means you get a later answer.

Jim

textex

9:03 pm on May 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks JD! It works! Have a great weeekend!

texanweb

2:32 am on May 20, 2006 (gmt 0)

10+ Year Member



jdMorgan,

I just wondering, why are yall so picky on live domains?

jdMorgan

4:43 am on May 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See stickymail.