• [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    Hi

    A few days ago I noticed at all my clients multisite subsites with their own domains have broken image links.

    I noticed the earlier thread on this forum mentioning turning on the AllowOverride to ALL. I contacted the host about this and he came back saying that “AllowOverride is configured correctly from what I can see, and the .htaccess file is being read by Apache. I am thinking that there might be an error in the .htaccess file.”

    I have checked the media library and front end of each of the subsites and they all contain lots of broken links.

    Old link structure that used to work in the multisite just a few days ago:
    https://vannsymposium.no/files/2011/12/vannkran.jpg

    New link structure:
    https://baldron.org/wp-content/blogs.dir/4/files/2012/06/valmues%C3%B8ster.jpg

    The .htaccess file contains this info:

    RewriteEngine on
    # -FrontPage-
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName flowfond.org
    AuthUserFile /home/flowfond/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/flowfond/public_html/_vti_pvt/service.grp
    # something...
    RewriteCond %{HTTP_HOST} ^elbeskyttelse.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www.elbeskyttelse.no$
    RewriteRule ^(.*)$ "http\:\/\/www\.baldron\.com" [R=301,L]
    RewriteCond %{HTTP_HOST} ^xn--el-flsom-84a.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www.xn--el-flsom-84a.no$
    RewriteRule ^(.*)$ "http\:\/\/www\.baldron\.com" [R=301,L]
    RewriteCond %{HTTP_HOST} ^xn--elflsom-s1a.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www.xn--elflsom-s1a.no$
    RewriteRule ^(.*)$ "http\:\/\/www\.baldron\.com" [R=301,L]
    RewriteCond %{HTTP_HOST} ^beedynamic.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www.beedynamic.no$
    RewriteRule ^(.*)$ "http\:\/\/www\.baldron\.com" [R=301,L]
    RewriteCond %{HTTP_HOST} ^quickzap.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www.quickzap.no$
    RewriteRule ^.*$ "http\:\/\/www\.baldron\.com" [R=302,L]
    # Typo3 mod_rewrite
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule   ^typo3$  typo3/index_re.php
    RewriteRule   ^[^/]*\.html$  index.php
    
    RewriteCond %{HTTP_HOST} ^baldron\.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.baldron\.no$
    RewriteRule ^/?$ "http\:\/\/www\.helseforhandleren\.no" [R=301,L]

    (more of the same as the 3 above lines continue in the htaccess file.)

    Anyone have any advice on how to proceed?

    Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I don’t see the WordPress code in that .htaccess…

    https://codex.www.ads-software.com/Multisite_Network_Administration#Apache_Virtual_Hosts_and_Mod_Rewrite

    the WP stuff should be at the very bottom.

    Thread Starter Paal Joachim Romdahl

    (@paaljoachim)

    My mistake I pasted in the wrong .htaccess file.
    Here is the correct one:

    #php_value memory_limit 64M
    
    RewriteEngine On
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^vannsymposium\.org$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.vannsymposium\.org$
    RewriteRule ^/?$ "http\:\/\/vannsymposium\.no" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^watersymposium\.de$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.watersymposium\.de$
    RewriteRule ^/?$ "http\:\/\/vannsymposium\.no\/\?lang\=de" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^quickzap\.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.quickzap\.no$
    RewriteRule ^/?$ "http\:\/\/www\.helseforhandleren\.no\/helse\/frekvensterapi\/quickzap\-frekvensterapi\.html" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^water\-symposium\.org$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.water\-symposium\.org$
    RewriteRule ^/?$ "http\:\/\/vannsymposium\.no\/\?lang\=en" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^watersymposium\.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.watersymposium\.no$
    RewriteRule ^/?$ "http\:\/\/vannsymposium\.no" [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    
    RewriteCond %{HTTP_HOST} ^husoghelseno\.flowfond\.org$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.husoghelseno\.flowfond\.org$
    RewriteRule ^/?$ "http\:\/\/www\.helseforhandleren\.no\/" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^byggebiologi\.org$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.byggebiologi\.org$
    RewriteRule ^/?$ "http\:\/\/byggbiologi\.org" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^husoghelse\.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.husoghelse\.no$
    RewriteRule ^/?$ "http\:\/\/www\.byggbiologi\.org" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^baubiologie\.se$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.baubiologie\.se$
    RewriteRule ^/?$ "http\:\/\/byggbiologi\.org" [R=301,L]
    
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    RewriteCond %{HTTP_HOST} ^baubiologie\.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.baubiologie\.no$
    RewriteRule ^/?$ "http\:\/\/byggbiologi\ \.org\/" [R=301,L]

    Thank you Ipstenu!

    Thread Starter Paal Joachim Romdahl

    (@paaljoachim)

    I uploaded an image and it instantly showed a broken image. It seems the main site is ok but the subsites have the broken images in the media library. Where they earlier had regular images. This is effecting jpg and png files. PDF files seem to be in place.

    I do now know how to proceed. No upgrade has happened on the site in the last few weeks that I am aware of.

    All plugins have been deactivated, but the images are still broken. I activated the plugins again.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Strip it down to just the WordPress stuff (yes, I know you mapped domains, we need to sort things out by stepping back).

    Thread Starter Paal Joachim Romdahl

    (@paaljoachim)

    WOW I stripped it down to only this:

    #php_value memory_limit 64M
    
    RewriteEngine On
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    RewriteCond %{HTTP_HOST} ^baubiologie\.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.baubiologie\.no$
    RewriteRule ^/?$ "http\:\/\/byggbiologi\ \.org\/" [R=301,L]

    And it works!! The images are now back in place! Man! Ipstenu thank you very very much! I will recommend my client to donate money for your awesome free support https://halfelf.org/about/ People let’s give something back to Ipstenu!

    —-

    I gradually added the mapped domains back. And got all of them back and the images are still in place. What a relief. I learned a few things about this process!
    Thank you again Ipstenu!

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Not a problem ??

    You always want to keep the WP ‘block’ for your htaccess at the very bottom, and don’t edit it. It’s fine to add lines above it, but I find it easiest to just keep WP by its lonesome, starting with that RewriteEngine On line.

    Thread Starter Paal Joachim Romdahl

    (@paaljoachim)

    Hmm I actually screwed things up even worse. The front pages for each site works, but the remaining pages get a 404 error. So I will need to get an older backup and check the htaccess file and see what I missed in the above code…..

    Thread Starter Paal Joachim Romdahl

    (@paaljoachim)

    I compared the htaccess file that I had uploaded to the original and noticed a lot of code missing which created 404 errors on all the subpages. So I uploaded the original htaccess file and I got the subpages back again and the images are still in place. So now it looks like it is alright.

    I went to the codex to find info on htaccess, as in breaking it a part and explaining in section but did not find any section on it.

    Thread Starter Paal Joachim Romdahl

    (@paaljoachim)

    This is the htaccess file that the clients multisite uses:

    #php_value memory_limit 64M
    
    RewriteEngine On
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^vannsymposium\.org$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.vannsymposium\.org$
    RewriteRule ^/?$ "http\:\/\/vannsymposium\.no" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^watersymposium\.de$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.watersymposium\.de$
    RewriteRule ^/?$ "http\:\/\/vannsymposium\.no\/\?lang\=de" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^quickzap\.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.quickzap\.no$
    RewriteRule ^/?$ "http\:\/\/www\.helseforhandleren\.no\/helse\/frekvensterapi\/quickzap\-frekvensterapi\.html" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^water\-symposium\.org$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.water\-symposium\.org$
    RewriteRule ^/?$ "http\:\/\/vannsymposium\.no\/\?lang\=en" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^watersymposium\.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.watersymposium\.no$
    RewriteRule ^/?$ "http\:\/\/vannsymposium\.no" [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    
    RewriteCond %{HTTP_HOST} ^husoghelseno\.flowfond\.org$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.husoghelseno\.flowfond\.org$
    RewriteRule ^/?$ "http\:\/\/www\.helseforhandleren\.no\/" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^byggebiologi\.org$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.byggebiologi\.org$
    RewriteRule ^/?$ "http\:\/\/byggbiologi\.org" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^husoghelse\.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.husoghelse\.no$
    RewriteRule ^/?$ "http\:\/\/www\.byggbiologi\.org" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^baubiologie\.se$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.baubiologie\.se$
    RewriteRule ^/?$ "http\:\/\/byggbiologi\.org" [R=301,L]
    
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    RewriteCond %{HTTP_HOST} ^baubiologie\.no$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.baubiologie\.no$
    RewriteRule ^/?$ "http\:\/\/byggbiologi\ \.org\/" [R=301,L]

    How can I improve the code?

    Have a great day!

    Thread Starter Paal Joachim Romdahl

    (@paaljoachim)

    The image links are broken again… sigh…

    Main site https://baldron.org seems to be ok. Even though Events Manager is not working on the site. There are ghosts in the system….

    Subsites such as https://vannsymposium.no/ I get broken images in the frontend and in the Media Library.

    I am playing with removing some of the code to see what cases the images to become broken. Using the below code breaks the image links in the backend and frontend.
    Not using the below code cases all pages except front pages to give me a non found 404 error.

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    Perhaps I can search on rewritecond and get some tips on how it should be used or something…

    Thread Starter Paal Joachim Romdahl

    (@paaljoachim)

    Ok I compared an older Htaccess file from a backup file and noticed what turned out to be a vital difference.

    Htaccess with error causing broken images.
    Has the RewriteEngine ON at the top as can be seen above. BUT

    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    Is located further down. This actually cases an error.

    So the correct setup that worked for me is:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    RewriteEngine On and right below is the RewriteBase, RewriteRule AND uploaded files.
    It seems these need to be gathered up top. Tight under php value memory limit 64m code. (Not even sure that the php value limit is needed though)
    I am hoping it will work this time.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘broken links’ is closed to new replies.