Viewing 8 replies - 1 through 8 (of 8 total)
  • Scott,
    This is something that is better handled with htaccess (if available).

    To do it with the plugin would require you to enter each URL in and that is not really feasible (and is a waste of resources).

    Regards,
    Don

    Thread Starter scottl31

    (@scottl31)

    That’s what I thought, but I don’t know the code or syntax etc. to put in the htaccess.

    Do you know?

    Scott,
    Something like this should work:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^/item/(.*) http://oursite.com/$1 [NC,R=301,L]
    </IfModule>

    A few things to note:

    • Make a copy of your .htaccess file before you start – that way if you screw anything up, you can just add back the original.
    • Change oursite.com in the code, to the actual URL of your site.
    • Make sure you put the code at the top of the .htaccess file and not in the WordPress section (not in the #BEGIN WordPress section).
    • If you have anything in the .htaccess at the top that is like AddType x-mapp-php5 .php, add it AFTER that.

    Hope this helps out.
    Regards,
    Don

    Thread Starter scottl31

    (@scottl31)

    Wow Don, thanks I’ll try this and let you know in a bit.
    Is the key to this putting it before the #BEGIN WordPress section?

    Do you know if something like this would also work to redirect if someone puts www on a subdomain like this:

    http://www.subd.oursite.com —> subd.oursite.com

    and have it apply to all internal pages?

    Thanks!

    yes, you want it before the WordPress section (although it should still work if you put it after as well – just not inside). That is because WordPress rebuilds the permalinks and anything inside will be deleted as it is dynamically created.

    The www should not make a bit of difference as you are just checking the URL after the protocol and domain – AS LONG AS the domain is a valid domain prefix (i.e., if http://www.sub. is a valid prefix, then it should work – usually you don’t see www used with a sub domain pointer, though, so it m ay not be valid).

    Hope that helps.
    Regards,
    Don

    Thread Starter scottl31

    (@scottl31)

    Hi Don,

    That first redirect didn’t seem to work. It’s a test site in a sub directory. The real site does not have /new4. Think that makes a difference? So from my above example, I’m actually removing “product/” Here’s my htaccess:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^/product/(.*) http://norfolkpress.com/new4/$1 [NC,R=301,L]
    </IfModule>

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /new4/
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /new4/index.php [L]
    </IfModule>

    # END WordPress

    Thanks!

    Scott.
    If your URL has the /new4 in it for the request, then you will need to add that to the redirect as well, like so:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^/new4/product/(.*) http://norfolkpress.com/new4/$1 [NC,R=301,L]
    </IfModule>

    That is because the URL request determines the redirect trigger.

    See if that helps.
    Don

    Thread Starter scottl31

    (@scottl31)

    I tried that and still not working. Anything else I did wrong?

    Here’s an actual url:

    http://norfolkpress.com/new4/product/california-faience-kirby-brown/

    should go to:

    http://norfolkpress.com/new4/california-faience-kirby-brown/

    Thanks again!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Is this the plugin I need for this?’ is closed to new replies.