.htaccess help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • The Dawg
    Confirmed User
    • Apr 2002
    • 2438

    #1

    .htaccess help

    Situation: Moved wordpress from /blog to root.

    New setup has a new front end, but the old blog posts are now being directed to /blog/ (works fine).

    Problem:

    The indexed search engine pages for "search" (http://www.domain.com/blog/?s=widget) are now 404.


    How can I use .htaccess to redirect /blog/?s=widget to domain.com/?s=widget


    Thanks
  • kazymjir
    Confirmed User
    • Oct 2011
    • 411

    #2
    Not tested, but try something like:

    Code:
    RedirectMatch 301 ^/blog/(.*)$ http://www.domain.com/$1
    http://kazymjir.com/

    Comment

    • Colmike9
      (>^_^)b
      • Dec 2011
      • 7230

      #3
      What about a plugin like http://wordpress.org/extend/plugins/404-redirected/
      Join the BEST cam affiliate program on the internet!
      I've referred over $1.7mil in spending this past year, you should join in.
      I make a lot more money in the medical field in a lab now, fuck you guys. Don't ask me to come back, but do join Chaturbate in my sig, it still makes bank without me touching shit for years..

      Comment

      • The Dawg
        Confirmed User
        • Apr 2002
        • 2438

        #4
        Originally posted by kazymjir
        Not tested, but try something like:

        Code:
        RedirectMatch 301 ^/blog/(.*)$ http://www.domain.com/$1
        I tried this one, but it was redirecting all /blog/ to root which conflicted with the blog portion of the site.

        Originally posted by Colmike7
        I am using another redirection plugin that does this also. I am using it to find all of the 404's. I think I'd rather do it through .htaccess (server side) vs. plugin as a long term solution.

        Comment

        • fris
          Too lazy to set a custom title
          • Aug 2002
          • 55679

          #5
          Code:
          Options +FollowSymLinks
          RewriteEngine on
          RewriteCond %{HTTP_HOST} ^fris\.net [NC]
          RewriteRule ^(.*)$ /$1 [L,R=301]
          http://fris.net/blog/test.html redirects now to http://fris.net/test.html
          Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

          Comment

          • AnniKN
            Confirmed User
            • Feb 2008
            • 1682

            #6
            This one is specifically for the search pages, rather than all things

            Code:
            RewriteEngine On
            RewriteRule ^\?s\=([^/]*)$ /blog/?s=$1 [L]
            hope it helps

            Comment

            • Nookster
              Confirmed IT Professional
              • Nov 2005
              • 3744

              #7
              Simply append [QSA] to your existing rule.

              When all else fails, consult the source: http://httpd.apache.org/docs/current...d_rewrite.html
              Last edited by Nookster; 08-19-2012, 12:33 PM.
              The Best Affiliate Software, Ever.

              Comment

              • garce
                Confirmed User
                • Oct 2001
                • 7103

                #8


                Not much help, but when all else fails... Weird Al for GOD! He's got my vote...

                Comment

                • Nookster
                  Confirmed IT Professional
                  • Nov 2005
                  • 3744

                  #9
                  Originally posted by garce


                  Not much help, but when all else fails... Weird Al for GOD! He's got my vote...
                  You're a moron and obviously didn't take anything into account. Typical CA.
                  Last edited by Nookster; 08-19-2012, 09:00 PM.
                  The Best Affiliate Software, Ever.

                  Comment

                  Working...