• Hi WP team,

    I have recently converted a PixelPost-based photoblog to WP3.0, to take advantage of the WP functionalities.

    However, I cannot seem to create a seemingly easy 301 rewrite to divert all old traffic, not sure if I made mistakes of that the internal rewrite rules of WP block this?

    I searched, but none of the similar threads on the forum have ever been answered.
    How would I rewrite from :

    domain.com/?showimage=xx
    to
    domain.com/?p=xx

    the xx is the variable page ID/number which is the same for both the old as well as the new system.

    Any help is much appreciated!
    Many thanks, Bike

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    The problem being its not a wordpress question ??

    This URL should help you.

    https://www.chilipepperdesign.com/2009/02/01/htaccess-query-string-301s

    Thread Starter Bike

    (@bike)

    Thanks Ipstenu; as long as WP needs .htaccess, then I think this is a WP question ??
    Besides, several people have tried to convert from PixelPost (or other CMS) to Wp, but are worried about whether their old pages ‘will work’, so I think this is definitely WP-worthy.

    I tried several options, but none worked. Anybody knows what is wrong?

    RewriteRule ^/\?showimage=([0-9]+)/?$ /\?p=$1 [R]
    RewriteRule ^showimage /p [R]

    RewriteCond %{QUERY_STRING} showimage=(.*)
    RewriteRule ^showimage(.*) /?p=%1 [R]

    Thanks, Bike

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I would try…

    RewriteRule ^/\?showimage=(.*) https://domain.com/\?p=$1 [R]

    Maybe. Juggling the ? Is a pain.

    Also, why I say it’s not a wordpress question is that WP works fine without this code. This is generic web admin stuff, not wordpress specific.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Taking a second look at what I have on my servers…

    RewriteCond %{QUERY_STRING} ^showimage=([0-9]*)$
    RewriteRule ^(.*)$ https://mydomain.site/?p=%1 [R=301,L]

    The catch is telling the server that it’s looking for a query string, which is NOT the same as escaping the ? character.

    This is all .htaccess mastery, though ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘301 rewrite in .htaccess not working, dynamic -> dynamic’ is closed to new replies.