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
- Getting a 500 Internal Server Error on Laravel 5+ Ubuntu 14.04
- Default .htaccess file for WordPress?
- htaccess problem after saving Settings
- File and directory permissions
- htaccess https redirect from www to non-www
- Name-based virtual host configuration in Apache seems to cause a “500 Internal Server Error”
- Isolating WordPress to a subfolder
- Error:406 not acceptable
- A plugin changes my .htaccess file and I can’t access httpd.conf as that’s a shared server
- Cache Busting using htaccess Rewrite rule?
- What is the role of .htaccess file in WordPress?
- different child theme for subdomain
- How do I edit the htaccess file to optimize my website?
- Block only external access to wp-cron.php on OpenLiteSpeed
- Site searches by Python for non-existent assets
- WordPress On subfolder
- Why is my mod_rewrite not working?
- How To Allow Only Specific User Agent To Access a URL?
- browser caching not disabled after disabling in .htaccess
- How to ignore folder in site root while accessing a URL
- Transfer to HTTPS – mixed content on main page only [closed]
- Htaccess redirect after changing Language URL format
- How can I enable keep alive (Not accessing to Apache)
- Add additional non-rewrite .htaccess directives on multisites via mod_rewrite_rules filter
- HTTP sitewide, except for: wp-admin, and 2 custom directories
- WordPress installed in root, need second in subdirectory with different domain
- htaccess has broken my site
- TimThumb & htaccess : clean url
- Rules in .htaccess only if the requested URL is /wp-admin
- What to write in the htaccess in order to detect browser language and point accordingly?
- how to redirect 301 my old search query string to wordpress search query string?
- Redirections and rewrites to subdomain
- How To Fix A Redirect Chain
- .htaccess RewriteCond excluding directories does not work when there is an .htaccess or php.ini in subdirectory
- Separate 404 page for WordPress in subfolder
- Weird behavior of Dashboard, must be core files
- Remove trailing slash after .html extension
- Does WP suppresses .htaccess if permalinks are disabled?
- How do I setup htaccess for 301 redirects, post Joomla to WordPress migration? [closed]
- Hide a subdirectory on my website hosting
- Can’t access WP site over WiFi network
- Creating a copy of a website in a subdirectory, wp-admin redirect problem
- I am new in word pres my font awesome is not allow
- htaccess redirect throws an error: PHP Catchable fatal error: Object of class WP_Error could not be converted to string
- WordPress permalinks confusion
- How do I reset a rewrite?
- VServer/Rootserver/Shared Hosting: Multiple WordPress installations each having their unique domain?
- Basic Auth .htaccess on wp-login, but allow logout from woocommerce
- Why my WordPress Site Asking for HTTP Authentication?
- htaccess redirects invalid request to home page not 404
- WordPress How to rewrite URL for custom pages
- How to properly give WordPress its own directory
- WordPress permalinks is wrong. It wants me to change my htaccess file. But then site crashes
- How to move wordpress website from hosting account to localhost
- Question with .htaccess and wp-login.php prevention
- WordPress RSS feed to external XML
- Does htaccess password keep search engines out?
- Pretty permalinks (again)
- htaccess old php pages to new wordpress ones
- different CNAME to corresponding subfolders
- block seacrh engines for all pages EXCEPT homepage
- Giving WordPress it’s own directory and using .htaccess Directory Index
- Allowing access to certain WordPress created pages or posts with htaccess / htpasswd
- Restrict download files from not generated Urls
- How to change wordpress news root url
- htaccess – Server Subdirectory With Different Name Than URL Subdirectory
- WordPress sections in htaccess kills FrontPage permissions
- Add rewrite endpoint and .htaccess
- WordPress redirection
- Home page returns 404
- Browser Caching .htaccess