WordPress.org

Support

Support » Plugins and Hacks » redirect sub folder to main domain

redirect sub folder to main domain

Viewing 10 replies - 1 through 10 (of 10 total)
  • jrf
    Participant

    @jrf

    Try:

    Source url: ^/v2/(.*)
    Regex: ticked
    Target url: /$1
    Type: 301 Moved permanently

    jim-jammer
    Member

    @jim-jammer

    Hello,
    My clients’ WordPress install is on Yahoo SB, so when i used the above expression, the URL looks like:

    http://1stjon.com/index.php/products/

    Is there an expression that would eliminate the /index.php/ part of the URL?

    Thanks for any help in advance!

    jrf
    Participant

    @jrf

    @jim-jammer

    First of all: you ought to open a new thread for a new question.

    Secondly, I haven’t got a clue about Yahoo SB, but to be honest it looks like you haven’t set up permalinks properly as otherwise you shouldn’t get the index.php. Go to your settings, check the permalinks settings and make sure you add the correct directives to your .htaccess file.

    So basically it looks like your question doesn’t have anything to do with the redirection plugin.

    Good luck.

    rerartist
    Member

    @rerartist

    There’s a good chance that the index.php part of the URL means IIS (Windows) servers, not Linux. I’m having similar difficulties with developing wordpress for an e-commerce site, especially with htaccess vs web-config. You might wanna check.

    vitamineg
    Participant

    @vitamineg

    having the same issue as @arathol. The suggestion by @jrf didn’t work?

    Thoughts?

    jrf
    Participant

    @jrf

    @vitamineg are you really having the same issue ? Then the solution *would* work. Otherwise it’s not exactly the same, so specify the differences as we can’t read minds, you know…

    vitamineg
    Participant

    @vitamineg

    Hmmm…. I sure think I am?

    I am using John Godley’s “redirection” plugin and followed your steps above. Didn’t seem to redirect the sub-directory landing page or any pages within the directory.

    Reading minds would be nice! 😉

    I have a subdomain using WP which has a sub-directory .. news.mydomain.com/subdirectory/

    I would like to redirect the sub-directory and all pages within it back to the top level domain (TLD)…or even Subdomain.

    i.e. news.mydomain.com/subdirectory/ AND news.news.mydomain.com/subdirectory/page1 301’d to mydomain.com or news.mydomain.com

    Thanks @jrf

    jrf
    Participant

    @jrf

    Ok, your question seems to have two parts:
    1) how to redirect subdirectory pages to the root directory (of the same domain). That can be done with the Redirection plugin following the steps outlined above – obviously replacing ‘v2’ in the regex with the name of your subdirectory.

    2) and here is the crux: you want to redirect between main domain and subdomain – that is very different from the original question and I would very strongly advise against doing that via the Redirection plugin.
    Simple reason is that you are using a hammer when a very small nail would suffice, i.e if you’d use the plugin, WP would need to be loaded before any redirection would occur, which is extremely inefficient.
    On that note: that might be the reason why it’s not working in 1). Is WP even being loaded for the original request page ?

    Ok, to sum up:
    Use the right tool, i.e. .htaccess. IMPORTANT: Place the .htaccess file in the subdomain root (news.mydomain.com) and in the root of any sub.subdomains (news.news.mydomain.com).

    In this .htaccess file place the following line:

    RedirectMatch permanent   ^/subdirectory/(.*)$		http://mydomain.com/$1

    You should place this anywhere before this snippet (if it exists in your .htaccess file):

    <IfModule mod_rewrite.c>
    RewriteEngine On

    Let me know how you get on.

    jim-jammer
    Member

    @jim-jammer

    @jrf,

    Thank you so much for your input.
    Yahoo SB *does not allow htaccess* in any way, shape or form.
    Also, Yahoo SB does not use permalinks per se, but uses their own *proprietary (as in fubar) permalinks plug-in*.
    After using redirect with the above expression,
    I still end up with /index.php/ subdirectory in the URL:
    http://1stjon.com/index.php/events/
    I have opened up a new thread but have not received a reply?
    Thanks in advance for your help!

    jrf
    Participant

    @jrf

    @jim-jammer sounds like this is a problem with the proprietary permalinks plugin, not with redirection. As I am not familiar with their plugin, I can’t help you. If that plugin is listed in the WP plugin directory, would be to open up a thread in their forum.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘redirect sub folder to main domain’ is closed to new replies.