I moved directory within a server so the Drupal 8 installed URL should change from ip-address/old-folder/d8 to my-site.com/d8/.

When I checked the new URL, the front page worked, but other pages gave a 404 error that said old-folder/d8/admin/structure/.

I read Moving drupal to a subdirectory, but the answer there didn't resolve my problem.

Which file/config I should change in Drupal 8.6?

  • 2
    Probably RewriteBase in .htaccess needs to change.
    – Kevin
    Feb 23 '19 at 13:28
  • 2
    There is no config option, Drupal 8 can run from any directory without configuration change. You only need to clear the cache.
    – 4k4
    Feb 23 '19 at 16:38
  • How about DB changes? Do I need to make changes in base url value? Because it's still showing 404 error after clearing cache.
    – Sintara
    Feb 25 '19 at 5:29

I would expect you just need to clear (or 'rebuild' as it is often called nowadays) the cache, as 4k4 is suggesting in a comment.

There are several ways you can do that:

  1. The "built-in" option is to go to /admin/config/development/performance and hit the clear cache button there.
  2. Another popular option is with drush, where you could issue drush cr to rebuild the cache from the command line. Your site or server would need to have drush installed, though. It can be a lifesaver if for whatever reason you can't get to the UI page, though.
  3. In a similar vain, drupal console (a tool quite similar to drush) can do the same thing, with drupal cache:rebuild, drupal cr or drupal cc.
  4. If you are running with the default database cache mechanism, you can truncate the tables that start with cache_ as their table name. Treat this as a last resort, though, and do make a backup in case you make a mistake. In particular, do not truncate the cachetags table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.