Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

.htaccess Redirect?

  • 07-07-2014 11:36AM
    #1
    Moderators, Technology & Internet Moderators Posts: 4,622 Mod ✭✭✭✭


    Say I develop a WordPress site and at the moment there is a redirect from domain.com/ to domain.com/site. I want to move the site to the root directory /. This isn't a problem.

    However, a lot of pages would have been linked directly to posts which if would show a 404 error.

    How to a redirect all pages/links on /site to / so if I was to browse to /site/about it would redirect to /about, and if I was to browse to /site/projects it would redirect to /projects, without having to list them manually?

    I could list them manually but I seem to remember some method of doing the above without manually listing them?

    Thanks in advance


Comments

  • Registered Users, Registered Users 2 Posts: 7,742 ✭✭✭mneylon




  • Registered Users, Registered Users 2 Posts: 6,677 ✭✭✭daymobrew


    Or you could change the links via WP Migrate DB. It involves exporting a .sql file with the corrected site data and then importing it, overwriting the existing database. Do backups before importing.

    If the development site is at domain.com/site there should not be incoming links (but a .htaccess could handle that).


  • Registered Users, Registered Users 2 Posts: 10,793 ✭✭✭✭maccored


    or change the main site url in the database from domain.com/ to domain.com/site


  • Registered Users, Registered Users 2 Posts: 63 ✭✭ThrowinShapes


    You could have a look at:
    coolestguidesontheplanet.com/redirecting-a-web-folder-directory-to-another-in-htaccess/

    What you're looking for is this:
    RewriteRule ^subdirectory/(.*)$ /$1 [R=301,NC,L]

    Just replace subdirectory with the subdirectory name of the old site.


  • Moderators, Technology & Internet Moderators Posts: 4,622 Mod ✭✭✭✭Mr. G


    You could have a look at:
    coolestguidesontheplanet.com/redirecting-a-web-folder-directory-to-another-in-htaccess/

    What you're looking for is this:
    RewriteRule ^subdirectory/(.*)$ /$1 [R=301,NC,L]

    Just replace subdirectory with the subdirectory name of the old site.

    That's what I was trying to find. Thanks!


  • Advertisement
Advertisement