Because when you request the document root, the rule in .htaccess
does not match and the request is not rewritten to the subdirectory. So the request falls through and whatever is the default response for the document root is served (eg. /index.php
if it exists).
You need to add another directive to rewrite the homepage only.
(The first RewriteRule
directive is not correct either.)
For example:
RewriteEngine On
RewriteBase /subwp/
RewriteRule ^[^/]+/index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
# Special case - rewrite requests for the homepage (which is also a directory)
RewriteRule ^$ index.php [L]
Since you are using RewriteBase
you can remove the /subwp/
prefix on the RewriteRule
substitution strings (that’s the whole point of using RewriteBase
).
Related Posts:
- Place static HTML files in path below WordPress page
- htaccess rewrite for author query string when WP is in subfolder
- Remove year and month in URL using .htaccess
- Rewrite rule not working
- .htaccess redirects disappeared after re-saving permalinks
- Protect Upload Folder Files With Ampersand Problem
- Remove File Extension for Page Outside of WordPress
- WordPress URL/Folder ReWrite using Htaccess
- WordPress mod_rewrite is canceling/overwriting my other mod_rewrite rule
- How can i redirect one url to another url using .htaccess or add_rewrite_rule
- Override htacces rule only for specific directory
- mod_rewrite loop, redirecting http to https on certain section of wordpress blog
- blocking access to all post/tag URIs via htaccess
- htaccess, site and staging in subdirectories
- How to write .htaccess so that https is on for subpages only but not the home page
- How to create a redirect in the .htaccess file, with 2 exceptions
- 404 error Additionally 403 Forbidden error on a URL
- Custom rewrite rule, url returning 404
- mod_rewrite doesn’t work as I want even with JSON API Plugin disabled
- I have a page using a pretty url and a mod_rewrite rule matching it. I expected it to give an error but it’s working. Why?
- disable WordPress 404 for one specific page/folder to receive actual php errors
- .htaccess Non-‘www’ to ‘www’ Subdomain Redirection Only Works for Homepage
- How can I create a smarter .htaccess file that will add a directory?
- Rewriting subfolders to specific parent folder in WordPress
- Redirect WordPress site to a landing (construction) page using htaccess, with access to /wp-admin and /invoice
- htaccess redirect to path
- I can access subdirectory, but not files within it
- htaccess mod_rewrite not working
- Add-on domain works in WordPress but links still lead to subdomain
- Are there any negative impact if access to directories were accidently denied?
- How to remove .html from URL?
- How to remove .html from URL?
- How can I use an .htaccess file in Nginx?
- .htaccess – how to force “www.” in a generic way?
- htaccess – Redirect to subfolder without changing browser URL
- .htaccess Remove WWW from URL + Directories
- How does RewriteBase work in .htaccess
- Getting a 500 Internal Server Error on Laravel 5+ Ubuntu 14.04
- Generic htaccess redirect www to non-www
- Best collection of code for your .htaccess file [closed]
- Default .htaccess file for WordPress?
- Which one does WordPress prioritize when it comes to php.ini, wp-config and .htaccess?
- Masking wp-content/themes/name/images to just images directory using htaccess
- Improve wordpress security by hiding non public resources
- WordPress site hacked. Has .htaccess been hacked?
- Does this .htaccess security setting really work?
- htaccess problem after saving Settings
- Stop WordPress and Plugins from Overwriting .htaccess
- File and directory permissions
- htaccess disable WordPress rewrite rules for folder and its contents
- htaccess rewrite conflict with wordpress rules and ssl
- htaccess https redirect from www to non-www
- Htaccess for Wordpess set on single subdomain
- adding rewrite rules in .htaccess
- .htaccess and 500 error, extra character added
- Name-based virtual host configuration in Apache seems to cause a “500 Internal Server Error”
- WordPress on a subdirectory of Laravel – WordPress pretty permalinks inner page shows laravel
- Static raw HTML page
- WordPress + Magento .htaccess ReWriteRule Issue (www vs. non-www)
- Plugin to edit htaccess file
- Why “Settings->Permalinks” creates .htaccess file on nginx server?
- .htaccess for wordpress inside another wordpress install
- .htaccess file redirecting to parent directory
- How to map permalinks with accented letters to sanitized slugs?
- Blog.php or how to display recent posts?
- Rewrite /?rest_route=/ link to /wp-json/ without changing default permalink structure in apache
- Globally force SSL on all pages
- Serve apache 404 for missing assets rather then wp 404 template WP_Rewrites
- Isolating WordPress to a subfolder
- Bypass .htaccess when using download_url
- index.php not loading in main folder of wordpress
- Admin-Ajax.php, SSL, Non-SSL
- Removing rules from .htaccess
- How disable SSL redirect for specific URL?
- .htaccess rewrite rule for removing .php extension with exception of wp login and wp-admin
- WordPress site displaying 404 for any page apart from index
- Why does the header set X-Robots-Tag apply to all pages?
- Permalinks not working on second wordpress installed in a subdirect
- How to avoid wordpress permalink rules to inherit in a sub-folder
- Error:406 not acceptable
- Unable to access WP admin
- .htaccess Rewrite URL WordPress
- Move wordpress to folder without changing urls
- A plugin changes my .htaccess file and I can’t access httpd.conf as that’s a shared server
- Cant block wordpress readme files
- Change wp-content without changing the name of the folder
- 404/500 error on /wp-json
- WordPress keeps deleting .htaccess file
- Cache Busting using htaccess Rewrite rule?
- WordPress multisite causing Error 101 (net::ERR_CONNECTION_RESET): Unknown error [duplicate]
- Correct htaccess to display page while also passing in GET parameters
- What is the role of .htaccess file in WordPress?
- Using “wordpress_logged_in” to restrict direct access to uploads folder in 2021
- Using WordPress only for the backend, and using AngularJS as a frontend
- Temporary .htaccess blocking is disabling WP Crons from running?
- How to restrict access to wp-content, wp-includes and all sub-folders
- Two domains on one WordPress Installation
- How have I misconfigured basic auth for my wordpress site?
- Is it possible to dynamically redirect URL using htaccess?
- How can I code my plugin to safely modify .htaccess?