301 ReWriteRule for directories?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LabelKing
    Senior Blueparker
    • Jan 2012
    • 1062

    #1

    301 ReWriteRule for directories?

    I'm trying to redirect my entire news structure to an identical structure on another site, how do I do that in BP?

    I've tried this:

    Code:
    RewriteRule ^news/$ http://www.newsite.co.uk/news/ [R=301,L]
    I've also tried ^news/*$ but both only seem to redirect that particular url, but not anything below it...?
  • Red Devil
    Senior Blueparker
    • Oct 2009
    • 2569

    #2
    Have you tried this? Note the "$1" for the newsite
    Code:
    RewriteRule ^www.oldsite.co.uk/directory/(.*)$ [URL]http://www.newsite.co.uk/anotherdirectory/$1[/URL] [R=301,L]
    https://www.hopevmselainesdogs.com/

    Comment

    • LabelKing
      Senior Blueparker
      • Jan 2012
      • 1062

      #3
      thanks, that worked.

      Comment

      • LabelKing
        Senior Blueparker
        • Jan 2012
        • 1062

        #4
        ok, that worked, but what happens if the structure isn't identical on the new site?

        So I want to redirect all pages in a specific subdirectory to a specific page on the new site. How do I do that?

        Comment

        • Red Devil
          Senior Blueparker
          • Oct 2009
          • 2569

          #5
          Isn't that simply this?

          Code:
          RewriteRule ^www.oldsite.co.uk/directory/(.*)$ [URL="http://www.newsite.co.uk/"][COLOR=#2060a0][URL="http://www.newsite.co.uk/newpage.html"]http://www.newsite.co.uk/[/URL][/COLOR][URL="http://www.newsite.co.uk/newpage.html"][/URL]newpage.html[/URL] [R=301,L]
          https://www.hopevmselainesdogs.com/

          Comment

          Working...