WordPress in root folder and vBulletin in subfolder - wordpress

I installed WordPress in my host root folder and I installed vBulletin in a subfolder.
I changed my WordPress default permalink to "postname".
Now when I want to open forum (the vBulletin subfolder), it redirects to root folder (WordPress) and gives "not found post".
When I delete .htaccess file in the root folder (WordPress), the subfolder works fine, but accessing WordPress posts gives 404 error.
How can I solve this problem?
It is my WordPress .htaccess file:
# 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
And this is the subfolder (vBulletin) .htaccess file:
# Comment the following line (add '#' at the beginning)
# to disable mod_rewrite functions.
# Please note: you still need to disable the hack in
# the vBSEO control panel to stop url rewrites.
RewriteEngine on
# Some servers require the Rewritebase directive to be
# enabled (remove '#' at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root vB folder (i.e. RewriteBase /forums/)
#RewriteBase /
RewriteCond %{HTTP_HOST} !^soft-game\.ir
RewriteRule (.*) http://soft-game.ir/forums/$1 [L,R=301]
RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap|api\.php)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php [L,QSA]

You should install wordpress and vBulletin in seperate folders, because a sub-folder in the wordpress insallation means that it is part of wordpress, and it will not act as an unique entity.
Create two folders, name first as 'blogs' or whatever for wordpress and create another folder in the root and name it 'forums' or whatever you like for vBulletin only then the 404 error from wordpress will disappear.

Related

Wordpress installation in subfolder backend not accessable

I have a Wordpress installation in the root folder of my server and another Wordpress installation in a subfolder called "neueseite".
I can access the frontend of the page in the subfolder but not the admin area (backend). When I try to access it, it shows me a 404 error: https://paarkultur.ch/neueseite/wp-login.php
All URLs in the database contain the URL with the subfolder. I also tried different things with the .htaccess file. Nothing helped.
Here is the code inside the root directory's .htaccess file:
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
# Include in the next line all folders to exclude
RewriteCond %{REQUEST_URI} !(neueseite) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
And this is the code in the subfolders .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /neueseite/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /neueseite/index.php [L]
</IfModule>
Can someone help me figure out what the problem could be?
I checked your nginx server and the below file is not located in the directory listed below:
https://paarkultur.ch/neueseite/wp-login.php
I can see that you have various core files such as wp-config.php, readme.html, etc but you do not have wp-login.php in that directory.
Anyway if you are trying to serve multiple sites from a single server then you are going the wrong way about it

Wordpress htaccess not working with subdirectory

i have directoryoffering-pages in my domain
offering-pages/.htaccess code is
# 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
i access dashboard of wordpress and only the home page of my website.
when i go to other page like http://domain/offering-pages/offerings-for-students/ it display the content of domain/index.php
Try this script and change domain and subdomain according to their names and also post wordpress related question to wordpress.stackexchange
RewriteEngine On
# rewrite subdomains to separate folder
RewriteRule ^subdomain/ - [L]
RewriteCond %{HTTP_HOST} !^www\.domain\.com$
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$
RewriteRule ^(.*)$ subdomain/$1 [L]
# or if you want to rewrite sub.domain.com/test to /subdomain/sub/test
#RewriteRule ^(.*)$ subdomain/%1/$1 [L]
# force www
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R]
# BEGIN WordPress
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./index.php [L]
# END WordPress
Did you install Wordpress in the offering-pages directory? If so, you need to change index.php to point to your directory where Wordpress is installed.
From:
require(dirname(__FILE__) . '/wp-blog-header.php');
To:
require(dirname(__FILE__) . '/offering-pages/wp-blog-header.php');
SOLVED!!!
The top site's custom Permalinks (anything other than "Plain") clash with the subdirectory site's custom Permalinks (anything other than "Plain").
Both cannot be set to be custom (without a complicated solution).
To fix (and not get "Invalid JSON response" when modifying or creating Posts and Pages), simply delete the top site's .htaccess file (in the root directory usually under public_html).
And to prevent future clashes, go to the top site's site Settings > Permalinks in WordPress and change the setting to Plain, delete any Category and Tag Base, and click SAVE. When you click SAVE, a new .htaccess file is created or the old one is overwritten for that directory (and Plain actually means an empty .htaccess file or no setting).
This means that you won't be creating pages and posts with pretty URLs from the top site (for that specific site you'll have to use an auto-generated post or page url like example.com/?p=123 instead of example.com/postname).
Antonio Robateau

Can I have another publicly accessible directory on Wordpress server?

I have a Wordpress site hosted by BlueHost. Is there a way I can create a new subdirectory under public_html that would not redirect to my Wordpress site? Do I need to modify the .htaccess file?
UPDATE:
Here's the .htaccess file currently:
# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~user/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~user/index.php [L]
</IfModule>
# END WordPress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
The above rewrite conditional checks validate that URL rewriting should only be done when the requested resource is not a readable directory or file. So if you have your public_html laid out as such:
public_html/
wp-admin/
...
wp-content/
...
wp-includes/
...
my-sub-site/
index.php
...
.htaccess
index.php
...
Then you should be able to access the my-sub-site/index.php without problems, as it exists and is readable (validate rwx access rights if it is not).

.htaccess for 2 CMS in different directories

My site is set up with 2 CMS syatems
In the root domain there is a Joomla website and in another directory called /word/ there is a wordpress directory.
The site originally was the wordpress site and this was moved to /word/ directory but to maintain all the original url's, I used mod_rewrite which works great until I insert the mod_rewrite for the Joomla site.
The mod_rewrite works great for the Joomla site but blocks all access to /word/ directory and 404 errors are thrown up. And if I leave the Joomla code out of the .htaccess I am left with the trailing /index.php/page name.
I have in my .htaccess file (This stops access to the /word/directory)
# Begin Joomla
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.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 . /word/index.php [L]
</IfModule>
# END WordPress
How can these 2 live together?
Joomla comes with its own .htaccess template which should be in the root folder and called htaccess.txt. Usually, I would rename to .htaccess and then un-comment this line:
# RewriteBase /
to:
RewriteBase /
My suggest would be to replace your "Joomla" section with the one provided by Joomla and see if that does the trick.

.htaccess, WordPress and mod_speling

I've got a server that has in its root directory a bunch of subdirectories, one of which has a WordPress.
directory1
directory2
wordpress
directory3
All of these except for the WordPress were migrated from a Windows server to a Linux server which means that we've lost case insensitivity.
I want the WordPress to be able to serve a URL like http://www.example.com/~subdomain, so there's an index file in the root directory. I also have two .htaccess files, one in the WordPress and one in the root directory.
The following is the root directory's .htaccess.
This is where I'd like to put mod_speling's case insensitivity directives, but it conflicts with the rewrite rule.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~subdomain/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~subdomain/index.php [L]
</IfModule>
# END WordPress
Below is the WordPress subdirectory's .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~subdomain/wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~subdomain/wordpress/index.php [L]
</IfModule>
# END WordPress
I've tried using a symlink in the root directory to point to the WordPress directory's index.php. I set the symlink to be the DirectoryIndex but unfortunately it results in a lot of the links turning into 404s.
At this point I'm kind of stuck. Any ideas?

Resources