WordPress.org

Ready to get started?Download WordPress

Forums

Redirection
redirect sub folder to main domain (11 posts)

  1. Arathol
    Member
    Posted 1 year ago #

    Hi, i put the previous site on a v2/ sub folder and notw the site is live, but i would like to redirect all the sub folder files and folders that dont exist to the main domain.

    How do i do this with expressions on this plugin?

    So what i would like is:
    http://www.website.com/v2/*.* to redirect to http://www.website.com/*.*

    Thanks for any help in advance.

    http://wordpress.org/extend/plugins/redirection/

  2. jrf
    Member
    Posted 1 year ago #

    Try:

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

  3. jim-jammer
    Member
    Posted 1 year ago #

    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!

  4. jrf
    Member
    Posted 1 year ago #

    @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.

  5. rerartist
    Member
    Posted 1 year ago #

    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.

  6. vitamineg
    Member
    Posted 12 months ago #

    having the same issue as @Arathol. The suggestion by @jrf didn't work?

    Thoughts?

  7. jrf
    Member
    Posted 12 months ago #

    @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...

  8. vitamineg
    Member
    Posted 12 months ago #

    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

  9. jrf
    Member
    Posted 12 months ago #

    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.

  10. jim-jammer
    Member
    Posted 11 months ago #

    @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!

  11. jrf
    Member
    Posted 11 months ago #

    @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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic