.htaccess redirect to the wrong locations

I am using a redirect to redirect visitors of my old blog to my new blog
Redirect 301 /log/ http://jasperfrumau.com/

Open in new window


this redirect seems to go to http://jasperfrumau.com/log and gives a 404. How can I fix this asap?

FYI http://wwww.gateway2thailand.com/log did go to http://jasperfrumau.com
rhandalthorAsked:
Who is Participating?
 
a1jConnect With a Mentor Commented:
Err i meant RewriteRule ^(log.*)$ http://jasperfrumau.com/ [R=301,L]

Or you can use redirectMatch instead of redirect:
RedirectMatch 301 ^(/log.*)$ http://jasperfrumau.com/ 

But i think your problem is that you are specifying it in .htaccess which is relevant only for current directory - you need to specify it in apache config.
0
 
a1jCommented:

You can try redirecting using mod-rewrite.

RewriteRule ^(.*)$ http://jasperfrumau.com/ [R=301,L]
0
 
crazedsanityConnect With a Mentor Commented:
@a1j: the .htaccess files are applied for the directory they're in and all subdirectories: http://httpd.apache.org/docs/1.3/howto/htaccess.html#how

I would suggest using RedirectMatch:
RedirectMatch    ^/log*    http://jasperfrumau.com/

Open in new window

0
 
rhandalthorAuthor Commented:
Seems like my redirect 301 is working after all. What is the benefit in using a RedirectMatch?
0
 
crazedsanityConnect With a Mentor Commented:
RedirectMatch uses regular expressions, which is especially useful to redirect people to the proper blog entry (assuming the entries are the same or can be programatically matched).  For instance, if the old blog is "/log/first_entry" and the new one is "http://domain.com/blog/first_entry", you could use:
RedirectMatch    /log/(.*)    http://domain/com/blog/$1

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.