I've installed wordpress in multisite mode on my localhost. I am using WAMP server on windows 10.
The parent site works well and can be accessed. However when I try to go to the sub sites It says the URL was not found on the server. Both for the sites as well as their backends.
I have followed the network setup instructions as specified by wordpress.
I think it's an issue with mod_rewrite, how ever in my httpd.conf when I uncomment
#LoadModule rewrite_module modules/mod_rewrite.so
I get an internal server error
My htaccess file is
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase sandbox/mainsite/
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
Another curious thing is that when I change the permalinks in wordpress to custom structure and hit save, it does not get saved and reverts to the previous setting.
Any Ideas?
Ok Fixed the Issue.
The problem was the Rewrite Base was not reading the correct URL.
Adding a '/' before it worked. So I changed
RewriteBase sandbox/mainsite/
to
RewriteBase /sandbox/mainsite/
Related
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.
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 tried to search this question, but I haven't found the solution. So just want to ask here.
It's very strange that when I manually changed .htaccess file for WordPress multisite as below via SSH on my server, the file will automatically changed back to the default content if I refresh the website in the browser.
I just used vi .htaccess SSH command to modify it, after I modified, I did nothing changed in WordPress admin and I tried to deactivate all the plugin.
The permission of .htaccess is 644.
I don't know the reason. It would be appreciated if you can give me some help.
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]
After I refresh the homepage, it will changed back to
# 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>
# END WordPress
Finally I fixed this issue. Just put the solution here for the people who has the same problem.
I've upgraded wordpress to the latest version, but I forget to upgrade the whole network, that's it, so stupid mistake.
WordPress changes .htaccess file itself - if it has write permission and you are using pretty links. I suggest adding your rules before original WordPress rules
... your rules ...
# BEGIN WordPress
... original rules ...
# END WordPress
As far as I remember WordPress does search for that comment lines. Bellow text is taken from WordPress source code:
Inserts an array of strings into a file (.htaccess ), placing it between
BEGIN and END markers. Replaces existing marked info. Retains surrounding
data. Creates file if none exists.
I have a laravel installation at same domain.com. The site is up and running. I need to install a wordpress in blog folder at domain.com/blog. when I try to install the wordpress, it's not allowing me to run the installation and says "This webpage has a redirect loop" . I installed wordpress by using domain.com/blog/index.php, But after installation I was not able to run the wordpress blog from domain.com/blog/
I have provided relevant permissions to the wordpress blog folder.I will be managing wordpress from the blog admin and laravel site from laravel section.
I have seen https://laracasts.com/discuss/channels/general-discussion/install-wordpress-in-domaincomblog but could not make it work.
Mu working environment is : Xampp in Ubuntu
Any suggestions will be helpful.
I got a solution from laravel forum. Adding the line in the htaccess worked for me.
RewriteCond $1 !^(blog)
Blog is working properly as a separate folder.
this line in .htaccess is probably your culprit:
RewriteRule .*/$ /$1 [L,R=301]
comment it out and see it that solves your problem.
This line forces everything in the public domain to go through laravel's router. You could probably leave it by writing another regex above that line looking specifically for the /blog directory, or rewrite that line to route anything that != your blog directory.
You should really leave that line there if possible.
Add below lines in .htaccess
RewriteCond $1 !^(bmcblog)
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
It will look like this
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond $1 !^(bmcblog)
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
I have a WordPress website that is set to direct to www by default. Everything works perfectly, however I have a few sections that are custom coded, to go to "profile" pages of local services, accommodation etc. this works fine in development however on the live server when you access the link via www.example.com/services/example-here/ it redirects to example.com/wp-content/themes/theme-here/custom/services.php?slug=example-here
I've been told by my webhost that it is WordPRess that is causing the issue, however everything says www.example.com/ (siteurl etc.)
Here is the code in the htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^.*services/(.*)/$ /wp-content/themes/theme-here/custom/services.php?slug=$1 [QSA,L]
RewriteRule ^.*accommodation/(.*)/$ /wp-content/themes/theme-here/custom/accommodation.php?slug=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Any ideas I've checked all my settings, Could it be a host issue inside of apache conf to do with mod re-write? I also might add that the code works perfectly without the www's added but my client requires the www.
Add a www forcing rule on top of this .htaccess just below RewriteBase / line:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]
Make sure in your permalink settings of WP you have blog address with www