.htaccess redirect to the wrong locations

Posted on 2011-05-08
Last Modified: 2012-05-11
I am using a redirect to redirect visitors of my old blog to my new blog
Redirect 301 /log/

Open in new window

this redirect seems to go to and gives a 404. How can I fix this asap?

FYI did go to
Question by:rhandalthor
    LVL 4

    Expert Comment


    You can try redirecting using mod-rewrite.

    RewriteRule ^(.*)$ [R=301,L]
    LVL 4

    Accepted Solution

    Err i meant RewriteRule ^(log.*)$ [R=301,L]

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

    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.
    LVL 9

    Assisted Solution

    @a1j: the .htaccess files are applied for the directory they're in and all subdirectories:

    I would suggest using RedirectMatch:
    RedirectMatch    ^/log*

    Open in new window


    Author Comment

    Seems like my redirect 301 is working after all. What is the benefit in using a RedirectMatch?
    LVL 9

    Assisted Solution

    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 "", you could use:
    RedirectMatch    /log/(.*)    http://domain/com/blog/$1

    Open in new window


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap ( Version 1.2 2.      Jpcap( Version 0.6 Prerequisite: 1.      GCC …
    In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now