I'm trying to set up a WordPress Multisite using subdirectories and I get a problem.
After I set up a Multisite in admin panel, following instructions, I edited two files on my server, 'wp-config.php' and '.htaccess'.
My .htaccess file looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress
After that I updated page and here's how they look like:
Site Page
In console there's a whole bunch of
"Failed to load resource" errors
Somehow it tries to load all the files from 'localhost' rather than from server. How can I fix this problem?
I resolved this issue by changing values in 'wp-options' table from 'localhost' to actual site domain.
Related
I'm new to VPS servers and just setting up a test environment to find my way around. I have WHM installed and have just created a new account with cpanel, I want to be able to visit the temp url, i.e. http://IP/~user however, when I visit, my browser adds a www. to the front (http://www.IP/~user/) which brings up a "page cannot be found" error.
Can anyone explain to me what is going on here and how I rectify it
Thanks
UPDATE: Here is my htaccess in the root of my public_html file (it's just a standard wordpress multisite htaccess)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
You have to enable mod_userdir from WHM backend
I am using wordpress 4.3.1, and thumbnails does not display in media library of subsite, rest all images works perfectly fine even in mainsite. Media library also works fine in main library. Even grid layout does not work and just keeps loading infinitely. I searched everywhere and wasted a whole day and still not able to arrive at a solution :( my .htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [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]
</IfModule>
# END WordPress
I just had to reinstall the the whole Multisite Network because my main domain had already a subdmoain in it.
If you main domain is like:
http://www.example.com
You will need to reinstall the network with main domain as:
http://example.com
I did that and the pictures are shown again.
I am moving a website to Wordpress, and using the Multiblog functionality. I'm not a htaccess expert by any means, but I do manage to use it regularly. So I'm reaching out here for some expert advice.
The website, www.blather.ie will use the same path for the sub-blogs as the old website. I need to keep legacy folders - like www.blather.ie/zeitgeist and some of the old content while publishing a Wordpress blog to the same path. I realised when I tried to this that 403 error would occur. So I found a workaround here and here.
Adding lines to my htaccess as described in those pages to my exist file didn't work. When I cleared out the htaccess file and started from scratch, I no longer got the 403 error - the content appeared, but without any themes/stylesheets. I checked the source, and saw that it was trying to pull the info from www.blather.ie/zeitgeist/wp-content... which doesn't exist - it needs to pull it from www.blather.ie/wp-content/...
Also, this 'fix' also started creating loops in the Admin back end. Not sure why.
So, here's my original htaccess file:
# BEGIN WordPress
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [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]
</IfModule>
# END WordPress
Here's the same htaccess with the recommended fix for the directory conflict problem, but which still causes the 403 error.
# BEGIN WordPress
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Fix 403 errors on existing directories; WordPress overrides.
RewriteCond %{REQUEST_URI} ^/(zeitgeist)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress
Here's a "clean" htaccess taken from the 1st recommended website - it cures the 403, but breaks paths, points to the wrong stylesheet location and causes redirect loops and 403s in the backend instead:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# Fix 403 errors on existing directories; WordPress overrides.
RewriteCond %{REQUEST_URI} ^/(zeitgeist)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
So - my question - where am I going wrong with paths, and causing these damn feedback loops?
Thanks in advance!
Try this? Use the basic WP .htaccess, don't get fancy at all and instead drop a tiny .htaccess in each legacy folder (these are dirs right?) that disables rewrite in the folder.
This method worked for me as I needed to provide access to legacy folders as well. There are some options you may need to hit with casual variations for environments. There are a few ways to do this such as disable rewrite, allow dir access, show details, etc so I can't include a snippet for you at this juncture.
I have installed WP multisite in my root directory. I also currently have a site running in this directory using Invision Power's IP Content, but renamed the index.php file to accommodate wordpress. I am running IP Board in /forum.
I have created a wordpress page (domain.tld/sample-page/), but when navigating to it, its unable to find it (landing page is not WP, but IP Content with "we could not find the page you were looking for). It looks like my site is looking at the IP Content database before WP so it is unable to find the page/directory in its own database because /sample-page/ does not exist in it, only in the WP database.
When I go to domain.com/index.php (which should bring up my WP blog) I get redirected to my home IP Content page at www.domain.com.
How can I have it look at the WP database for things like this?
My .htaccess file:
# Loads home.php first (ip.content). Wordpress is index.php
DirectoryIndex home.php index.php index.html maintenance.html
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !.*\.(jpeg|jpg|gif|png|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /home.php [L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# Multisite
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
# Multisite
# END WordPress
The first set of conditions cause anything that isn't an image, file or directory to go to the home.php front controller, this prevents them from being satisfied by the similar WordPress rules. You could add some more specific conditions to only pass certain pages to home.php or just remove that set of conditions and rules.
These two CMSs will not run well together, I'd put them on separate domains or subdomains.
On my server I've got a single WordPress installation for my own company website.
Besides that, I would like to create a demo area for clients.
At the moment I've got the following setup and folders:
www.domain.com - Single WordPress installation for company website
www.domain.com/demo/ - WordPress Multisite
At the moment all the clients websites have the following domain structure:
www.domain.com/demo/client1, www.domain.com/demo/client2, etc.
Instead of those long urls, I would like a subdomain:
demo.domain.com/client1, demo.domain.com/client2, etc.
WordPress Multisite standard generates the following .htaccess:
RewriteEngine On
RewriteBase /demo/
RewriteRule ^index\.php$ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [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]
From other topics at stackoverflow I've found the following:
RewriteRule ^demo/(.*) demo.domain.com/$2/
But unfortunately this doesn't work. Anybody who can help me?
Thanks in advance!
Keep the multisite .htaccess where it is and put this in the .htaccess in the root of your web directory:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^demo
RewriteRule ^(.*)$ http://www.domain.com/demo/$1