Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

.htaccess Redirect?

  • 07-07-2014 10:36am
    #1
    Moderators, Technology & Internet Moderators Posts: 4,621 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,740 ✭✭✭mneylon




  • Registered Users, Registered Users 2 Posts: 6,571 ✭✭✭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,748 ✭✭✭✭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,621 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