I have changed my flarum site to a new domain(from a.com to b.com). This time I don't have use public folder, I take all the files out off public folder.

The [site] runs well over all, but all the images are not showing up.

I have change all the url from a.com to b.com by replace command in the database. And copied all the files.

However, all the avatars and images links are 404.

for examples:

is accessible. But

doesn't

And I don't see any difference between permission or ownership. So I presume the files in avatars and files should be accessible. then it shouldn't return 404.

for xyz

Did I miss anything here? Thanks in adavance for your help.

    Hi, Can anyone help me with this please?

    Things I did so far, following the suggestions by ChatGPT:
    ps aux | grep apache

    then find user hrjhxyz

    chmod -R 755 assets
    chown -R hrjhxyz:hrjhxyz assets

    I did not install flarum from composer, rather I just move the files and database, then did

    composer update --prefer-dist --no-plugins --no-dev -a --with-all-dependencies
    php flarum migrate
    php flarum cache:clear

    All other works, but not the images.

      ash3T post the contents of your site.php and the directory structure of where the public/assets now are.

        luceos

        Here is site.php

        <?php
        
        /*
         * This file is part of Flarum.
         *
         * For detailed copyright and license information, please view the
         * LICENSE file that was distributed with this source code.
         */
        
        /*
        |-------------------------------------------------------------------------------
        | Load the autoloader
        |-------------------------------------------------------------------------------
        |
        | First, let's include the autoloader, which is generated automatically by
        | Composer (PHP's package manager) after installing our dependencies.
        | From now on, all classes in our dependencies will be usable without
        | explicitly loading any files.
        |
        */
        
        require __DIR__.'/vendor/autoload.php';
        
        /*
        |-------------------------------------------------------------------------------
        | Configure the site
        |-------------------------------------------------------------------------------
        |
        | A Flarum site represents your local installation of Flarum. It can be
        | configured with a bunch of paths:
        |
        | - The *base path* is Flarum's root directory and contains important files
        |   such as config.php and extend.php.
        | - The *public path* is the directory that serves as document root for the
        |   web server. Files in this place are accessible to the public internet.
        |   This is where assets such as JavaScript files or CSS stylesheets need to
        |   be stored in a default install.
        | - The *storage path* is a place for Flarum to store files it generates during
        |   runtime. This could be caches, session data or other temporary files.
        |
        | The fully configured site instance is returned to the including script, which
        | then uses it to boot up the Flarum application and e.g. accept web requests.
        |
        */
        
        return Flarum\Foundation\Site::fromPaths([
            'base' => __DIR__,
            'public' => __DIR__,
            'storage' => __DIR__.'/storage',
        ]);

        and all these files are in the public_html

        Plus I made the following changes in .htacess file:

          # Uncomment the following lines if you are not using a `public` directory
          # to prevent sensitive resources from being exposed.
           RewriteRule /\.git / [F,L]
           RewriteRule ^auth\.json$ / [F,L]
           RewriteRule ^composer\.(lock|json)$ / [F,L]
           RewriteRule ^config.php$ / [F,L]
           RewriteRule ^flarum$ / [F,L]
           RewriteRule ^storage/(.*)?$ / [F,L]
           RewriteRule ^vendor/(.*)?$ / [F,L]

        And I just check the error log:

        I checked on ChatGPT, and it suggested me to do the following:

        composer update fof/follow-tags --with-dependencies
        composer update flarum/core --with-dependencies

        However, because my server's php version is 8.0. So my flarum is stuck with 1.7.0 for now.

        Flarum core: 1.7.0
        PHP version: 8.0.30
        MySQL version: 5.7.44
        Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, readline, Reflection, SPL, session, standard, bcmath, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, iconv, imap, exif, mysqlnd, PDO, Phar, posix, SimpleXML, sockets, sqlite3, tokenizer, xml, xmlwriter, xsl, zip, mysqli, pdo_mysql, pdo_sqlite, xmlreader
        +------------------------------------+---------+--------+
        | Flarum Extensions                  |         |        |
        +------------------------------------+---------+--------+
        | ID                                 | Version | Commit |
        +------------------------------------+---------+--------+
        | flarum-flags                       | v1.7.0  |        |
        | flarum-suspend                     | v1.7.0  |        |
        | flarum-approval                    | v1.7.0  |        |
        | flarum-tags                        | v1.7.1  |        |
        | flarum-bbcode                      | v1.7.0  |        |
        | fof-upload                         | 1.3.4   |        |
        | flarum-sticky                      | v1.7.0  |        |
        | fof-formatting                     | 1.0.3   |        |
        | fof-spamblock                      | 1.1.2   |        |
        | flamarkt-backoffice                | 0.1.4   |        |
        | fof-byobu                          | 1.3.6   |        |
        | flarum-likes                       | v1.7.0  |        |
        | fof-merge-discussions              | 1.3.1   |        |
        | afrux-forum-widgets-core           | v0.1.7  |        |
        | zerosonesfun-member                | 1.2     |        |
        | zerosonesfun-featured-card         | 1.0.3   |        |
        | zerosonesfun-collection            | 1.2     |        |
        | zerosonesfun-bbcode-space          | 1.0     |        |
        | zerosonesfun-bbcode-iframe         | 1.0     |        |
        | zerosonesfun-bbcode-button         | 1.1.3   |        |
        | zerosonesfun-bbcode-audio          | 3.1.3   |        |
        | zerosonesfun-bbcode-advanced-image | 0.3     |        |
        | zequeen-acgembed-remastered        | v1.1.2  |        |
        | v17development-user-badges         | v1.1.0  |        |
        | v17development-seo                 | v1.8.1  |        |
        | the-turk-stickiest                 | 2.0.3   |        |
        | the-turk-quiet-edits               | 0.1.3   |        |
        | the-turk-nodp                      | 1.0.1   |        |
        | the-turk-flamoji                   | 1.0.4   |        |
        | sycho-lite-youtube                 | v0.1.1  |        |
        | sycho-discussion-canonical-url     | 0.1.1   |        |
        | ramesh-dada-bbcode-alerts          | 6.21    |        |
        | nearata-related-discussions        | 1.4.0   |        |
        | nearata-internal-links-noreload    | v2.1.3  |        |
        | nearata-copy-code-to-clipboard     | v2.1.0  |        |
        | katosdev-signature                 | 1.6     |        |
        | justoverclock-header-slideshow     | 0.1.1   |        |
        | justoverclock-hashtag              | 1.0.1   |        |
        | justoverclock-guestengagement      | 1.0.3   |        |
        | itnt-uitab                         | v0.4.2  |        |
        | imshuzai-right-and-center-bbcode   | 1.0.0   |        |
        | imshuzai-phonetic-bbcode           | 1.0.0   |        |
        | ianm-synopsis                      | 1.3.1   |        |
        | ianm-no-meta-title                 | 1.1.0   |        |
        | ianm-log-viewer                    | 0.1.1   |        |
        | fof-stopforumspam                  | 1.2.4   |        |
        | fof-split                          | 1.1.1   |        |
        | fof-socialprofile                  | 1.1.6   |        |
        | fof-sitemap                        | 1.0.3   |        |
        | fof-profile-image-crop             | 1.1.6   |        |
        | fof-pretty-mail                    | 1.1.2   |        |
        | fof-polls                          | 2.1.2   |        |
        | fof-pages                          | 1.0.8   |        |
        | fof-oauth                          | 1.4.4   |        |
        | fof-masquerade                     | 1.0.0   |        |
        | fof-links                          | 1.2.3   |        |
        | fof-linguist                       | 1.1.2   |        |
        | fof-impersonate                    | 1.1.1   |        |
        | fof-ignore-users                   | 1.2.1   |        |
        | fof-html-errors                    | 1.1.2   |        |
        | fof-geoip                          | 1.2.0   |        |
        | fof-drafts                         | 1.2.2   |        |
        | fof-discussion-thumbnail           | 1.1.3   |        |
        | fof-best-answer                    | 1.3.2   |        |
        | fof-bbcode-tabs                    | 1.0.3   |        |
        | fof-bbcode-details                 | 1.1.2   |        |
        | fof-ban-ips                        | 1.0.3   |        |
        | fof-analytics                      | 1.1.0   |        |
        | flarumtr-mobile-search             | v1.2    |        |
        | flarumite-simple-spoilers          | 1.0.0   |        |
        | flarumite-simple-discussion-views  | 1.2.1   |        |
        | flarum-subscriptions               | v1.7.0  |        |
        | flarum-statistics                  | v1.7.0  |        |
        | flarum-nicknames                   | v1.7.0  |        |
        | flarum-mentions                    | v1.7.0  |        |
        | flarum-markdown                    | v1.7.0  |        |
        | flarum-lock                        | v1.7.0  |        |
        | flarum-lang-english                | v1.7.0  |        |
        | flarum-lang-chinese-simplified     | v1.3.0  |        |
        | flarum-emoji                       | v1.7.0  |        |
        | ecnu-im-sticky-sidenav             | v1.1.0  |        |
        | davwheat-share                     | v1.1.0  |        |
        | davwheat-session-keepalive         | 1.1.0   |        |
        | davwheat-ads                       | 1.2.0   |        |
        | datlechin-scroll-buttons           | v1.1.0  |        |
        | darkle-fancybox                    | 0.2     |        |
        | clarkwinkelmann-status             | 1.0.0   |        |
        | clarkwinkelmann-post-bookmarks     | 1.0.0   |        |
        | clarkwinkelmann-likes-received     | 1.0.2   |        |
        | clarkwinkelmann-discussion-lists   | 1.0.0   |        |
        | clarkwinkelmann-author-change      | 1.0.3   |        |
        | blomstra-turnstile                 | 0.1.2   |        |
        | blomstra-flag-duplicates           | 0.1.8   |        |
        | aurorum-better-iframe              | v2.0.2  |        |
        | askvortsov-pwa                     | v3.4.1  |        |
        | askvortsov-markdown-tables         | v1.2.1  |        |
        | askvortsov-help-tags               | v1.1.0  |        |
        | antoinefr-bbcode-fa                | v1.0.0  |        |
        | afrux-online-users-widget          | v0.1.6  |        |
        | afrux-news-widget                  | v0.1.1  |        |
        +------------------------------------+---------+--------+
        
        
        Queue driver: sync
        Session driver: file
        Scheduler status: Never run
        Mail driver: mail
        Debug mode: off

          ash3T Then turn off the FollowTags plugin, however, same error persists.

          Your php info doesn't show you're using opcache. But this is usually still the case. Can you try reloading or restarting your webserver once you changed your extensions?

          This error won't cause your assets to go missing though. Can you share the contents/structure of your public directory and perhaps public/assets too? I think the assets ended up elsewhere.

            luceos

            ash3T and all these files are in the public_html

            I did mentioned the location of assets folder. I have move it out off the public folder, because I got stuck with public_html as my root server.

            You can find it in the above screenshot, the assets folder are taken out from the public folder, and are in the same folder with storage, vendor folder.

            Thank you.

            By the way, I am using share hosting and don't have the root access to restart my webserver. :(

              ash3T assets needs to be in public, unless you don't use the public directory

                luceos

                Unfortunately, I got stuck with public_html. I have mentioned this in my first sentence of this post.

                ash3T This time I don't have use public folder, I take all the files out off public folder.

                As it mentioned in the flarum docs:

                I am under this circumstance:

                your host doesn't give you control over your webroot (you're stuck with something like public_html or htdocs), you can set up Flarum without the public directory.

                so I did the following

                Simply move all the files inside the public directory (including .htaccess) into the directory you want to serve Flarum from. Then edit .htaccess and uncomment lines 9-15 in order to protect sensitive resources. For Nginx, uncomment lines 8-11 of .nginx.conf.

                You will also need to edit the index.php file and change the following line:

                $site = require './site.php';

                Edit the site.php and update the paths in the following lines to reflect your new directory structure:

                'base' => __DIR__,
                'public' => __DIR__,
                'storage' => __DIR__.'/storage',

                I have move all the files inside the public directory (including .htaccess) into the public_html folder.


                Or if the above screenshot shows a clear picture.

                And the photos can upload to assets files successful.

                Can anyone please help me with this? I got stuck with this for days.