Saturday, January 14, 2023
HomeWordPress Developmentpermalinks - Easy methods to use 'blogs.dir' as media add as an...

permalinks – Easy methods to use ‘blogs.dir’ as media add as an alternative of ‘uploads’ listing in WordPress multisite setup


Setup 1 :

The overall subdomain/custom-domain primarily based multisite setup for youngster community websites has its add listing like this

/dwelling/example1.com/public_html/wp-content/uploads/websites/8/2022/01/emblem.png

example1.com : the first WordPress multisite community

example2.com : the kid community website with website id 8 underneath example1.com

This file could be accessed from the kid community website from the next URL

https://www.example2.com/wp-content/uploads/websites/8/2022/01/emblem.png

the final .htaccess file for subdomain primarily based community website is following


# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content material|admin|consists of).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule . index.php [L]
# END WordPress

Setup 2 :

In a subdomain/custom-domain primarily based multisite setup I’ve acquired this add listing, it makes use of blogs.dir as an alternative of uploads listing

/dwelling/example1.com/public_html/wp-content/blogs.dir/8/recordsdata/2022/01/emblem.png

The kid community website has following file path

example2.com/recordsdata/2022/01/emblem.png

.htaccess of this setup is right here


RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteRule ^(.*/)?recordsdata/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?recordsdata/(.*) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content material|admin|consists of).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule . index.php [L]

I’ve tried utilizing this for brand spanking new basic set up the place the supposed add path is blogs.dir however having this .htaccess does nothing.

There is no such thing as a such distinction in wp-config.php file that would have an effect on this setup


/* Multisite */
outline( 'WP_ALLOW_MULTISITE', true );
outline( 'MULTISITE', true );
outline( 'SUBDOMAIN_INSTALL', true );

outline( 'DOMAIN_CURRENT_SITE', 'www.example1.com' );
outline( 'PATH_CURRENT_SITE', "https://wordpress.stackexchange.com/" );
outline( 'SITE_ID_CURRENT_SITE', 1 );
outline( 'BLOG_ID_CURRENT_SITE', 1 );

outline('ADMIN_COOKIE_PATH', "https://wordpress.stackexchange.com/"); // eliminated for disguise my wp ghost plugin

outline('COOKIE_DOMAIN', $_SERVER['HTTP_HOST'] );
outline('COOKIEPATH', '');
outline('SITECOOKIEPATH', '');

outline( 'NOBLOGREDIRECT', '/404' );

Each setup was completed by me and I do not bear in mind any settings contained in the dashboard that would change this. Permalinks checked; all doable settings contained in the dashboard checked.

Basic multisite set up exposes website id in media path like this

https://www.example2.com/wp-content/uploads/websites/8/2022/01/emblem.png

The objective is to not expose website id in media path
example2.com/recordsdata/2022/01/emblem.png

What am I lacking right here?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments