Welcome to WebmasterWorld Guest from

Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

Redirection in wordpress

I would a help to configure a redirect 301 with a plugin in wordpress



8:46 pm on Sep 10, 2013 (gmt 0)

Hi guys, im new here and this is my first post.
I will really appreciate a help about redirection.
I'll explain it better with this expample


Our site has these urls... and we dont have access at that webserver, out hosting do not accept that. So we would to transfer our hosting and try to remake the site with wordpress.

I bought a domain and hosting to test it. ( www.expample2.com )
I cant use cpanel to make the redirect because I have installed wordpress in the main domain, so i have to use worpress redirect... and I installed REDIRECTION from [wordpress.org...] that is a really nice plugin.
[d2o0t5hpnwv4c1.cloudfront.net ]
This is how the plugin show himself.

I have 4 option in Match:
1 - URL only
2 - URL and referrer
3 - URL and user agent
4 - URL and login status

I tested to redirect a page that does not exist:
  • http://www.example2.com/index.asp?pagename=Page+Title
  • http://www.expample2.com/Page-Title

    It is working! ( so when we will lose all our page /index.asp?pagename... we could redirect them to the new pages... :) )

    The problem is that i cannot do that 10 or more times for the same page ( that have a lot of different URL!).

    So probably I need a help to insert in this source URL some different code probably also checking Regular expression.

    - The url could have www or non-www
    - Page+Title or page+title
    - Sometime in google i can find the &site=1&siteid=483 in some URL and sometime not..

    Please can you help me to write this? Thanks.
  • lucy24

    10:34 pm on Sep 10, 2013 (gmt 0)

    WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

    Whoa there. Backtrack. You've given a lot of sample URLs but the part you haven't explained is what you want to do with them:

    oldURL > newURL
    oldURL2 > newURL2
    oldURL3 > newURL3
    et cetera.

    Are you moving material between the path (the part before the ? question mark) and the query (the part after the ? question mark)? Or are you only editing the query?

    Does the plugin require a hostname? Are there other requests passing through the same htaccess that might fit the same path pattern, that must not be redirected?

    "htaccess" here and elsewhere = "htaccess or IIS equivalent"

    Psst: If you need to name more than one domain in the Forums, you can say example.org, example.net or example.anything-in-the-world.

    You can do a certain amount with plugins (this applies to any CMS, not only WordPress). But eventually you will have to throw in the towel and edit the htaccess file directly.

    Please say your public URLs don't really end in "index.asp" (or index.anything) ;)


    1:07 am on Sep 11, 2013 (gmt 0)

    I will try to explain better what i mean :)

    Our About Us page ( and every other page) is accessible from various URL


    and tons of different way to write this URL ( probably because there is any kind of rewriting... no preferred version of WWW or non-WWW, not rel canonical... and Google indexed our page randomly... page1 in a way, page2 in another way, page 3 in another way, and so on... our link juice is diluted in billion of different URL... XD Our back-links are useless

    What you can see in Bold is what you can see for real in our REAL address! It's really ugly i know :( so the index.asp?pagename= there is in any page that we have is the base of any kind of URL! :(

    There is no way to manually modify this :(
    Plus all our image point to our hosting provider.. and not to our site ... -.-"
  • http://www.hosting-that-we-use.com/sitefiles/483/image/image-name.jpg

    So we are thinking to change host and start all over

    When we will start in wordpress our pages will be

    example.com will be the same

    I would like to redirect all that version that i described above to our new friendly version, and this for at least 30 or 40 pages...

    and all different version of this page will redirect to

    and all different version of this page will redirect to

    and all different version of this page will redirect to

    Can you help me with this information or do you need more? :(
    Thanks in advance
  • lucy24

    1:52 am on Sep 11, 2013 (gmt 0)

    WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

    Can you help me with this information


    If you are looking for instructions on a WordPress plugin, don't look at me. But stick around, because someone else hereabouts will know. You are in the right forum.

    If your server is IIS, don't look at me. But someone next door in the /iis/ forum will know.

    If your server is Apache and you're ready to get your hands dirty with the htaccess file, step next door to the /apache/ forum and you will see me again, along with assorted other people :) (Given .asp, this is not likely. But I wanted to cover all possibilities.)

    Conceptually you want to do two things:

    Redirect all requests containing certain elements to a brand-new extensionless URL.

    Rewrite all requests for this pretty new URL to an .asp page-- either a pre-existing one or a newly created one, doesn't matter-- that will serve the content.

    These are both good and worthy aims. All we need now is to hammer out the mechanics.


    4:49 am on Sep 11, 2013 (gmt 0)

    Mmmm probably u could help me if u can write some regex about what i need...
    (Is htaccess written thanks to regular expression or not?)

    I need a regex that works for that example that i done if you could help me to write it for htaccess, probably i could convert for wordpress plugin :)

    something that translate this


  • www or not www
  • A or a
  • U or u
  • + or %20 or (space)
  • with or without &site=1&siteid=483

    www(or non-www).example.com/index.asp?pagename=A(or a)bout+(or %20)U(or u)(nothing-else or also &site=1&siteid=483)

    ( Im really sorry this is not code, this is what i would like your code could do for me xD in my pesonal way to explain what i need :( )

    How could you write this in htaccess ( only concerning this about us page)?
  • lucy24

    5:04 am on Sep 11, 2013 (gmt 0)

    WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

    Ouch. Is that how the plugin works? Complete url from beginning to end, including hostname and query string? Yuk.

    :: irritably wondering where all the WP folks got to ::

    Will the element "pagename=about+us" always come at the front of the query string?

    Viewed purely as literal text seeking a Regular Expression:


    ... and then simply leave off the closing anchor and it won't matter what, if anything, comes afterward. If your plugin doesn't do anchors-- meaning that it doesn't recognize the lack of an anchor-- add


    at the end.

    A literal space in the query should always turn into a + sign before it goes anywhere. But it it doesn't and you need to allow for all possibilities, replace \+ with

    ([+ ]|%20)

    How could you write this in htaccess

    Meaningless question, unfortunately. The rule has to be written for some specific module. If it were really htaccess, meaning apache, you'd be looking at mod_rewrite. But surely you're in IIS?


    1:25 pm on Sep 11, 2013 (gmt 0)

    Thanks for your patience! :) Probably we got some good news! :)

    I found what the plugin does if i write just a specific URL to redirect like this:

    Redirect to

    # Created by Redirection Module: WordPress
    # Wed, 11 Sep 2013 13:06:04 +0000
    # Redirection 2.3.3 - [urbangiraffe.com...]

    <Files .htaccess,.svn>
    order allow,deny
    deny from all
    Options +FollowSymlinks

    <IfModule mod_rewrite.c>
    RewriteRule ^index\.asp%3Fpagename%3DAbout%2BUs$ http://example.com/about-us/ [R=301,L]

    # End of Redirection

    Is something that you can manage now? ( is it like a part of a htccess?)
    can we figure out more now ? :D


    7:33 pm on Sep 11, 2013 (gmt 0)

    WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

    OK, now I gotta go back and rewind. I thought .asp was strictly an IIS thing. But .htaccess I can do.

    The bad news is...

    RewriteRule ^index\.asp%3Fpagename%3DAbout%2BUs$ http://example.com/about-us/ [R=301,L]

    That %3F is a percent-encoded question mark ... which cannot occur in the path of an URL. The rule is looking for things in the path that aren't in the path, so the rule never applies. You will need to go back and read the instructions for the plugin, and find out how to handle query strings. If it doesn't say, throw the plugin away :(

    An htaccess file will contain a piece that looks like this:

    Options +FollowSymLinks
    RewriteEngine on

    These two lines occur only once, at the beginning. Then, for each page, there will be two rules. All the ones marked [R=301] come in a group first, and then the ones marked [L].


    RewriteCond %{QUERY_STRING} pagename=about([\ +]|%2[B0])us [NC]
    RewriteRule ^/(?:index\.asp|$) http://www.example.com/about-us [R=301,L]

    {add similar Rule-plus-Condition pairs for other pagenames}

    RewriteRule ^about-us$ /index.asp?pagename=About+Us

    {add similar Rules for other pagenames, matching the first set}

    I doubt the ([\ +]|%2[B0]) is really necessary; a simple + should do it.

    Be careful! WordPress creates its own htaccess file and will overwrite anything you've already got in place. So if you are editing the htaccess on your own, make sure to keep a copy. Any time you upgrade WP you will need to replace the htaccess file.

    Featured Threads

    Hot Threads This Week

    Hot Threads This Month