: Subdomain htaccess rules I have the following .htaccess in my root: DirectoryIndex index.html index.php Options +Indexes # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule
I have the following .htaccess in my root:
DirectoryIndex index.html index.php
Options +Indexes
# 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 want to add the following rule for everything under the /account folder:
ErrorDocument 404 /error.php
I believe it should start with RewriteCond %{REQUEST_URI} !^/account but I'm not sure how to write the actual rule nor where in the document to add this.
Any help is much appreciated.
EDIT: I tried in /account/.htaccess :
ErrorDocument 404 /error.php
# Enable the rewrite engine in the subdirectory to prevent
# mod_write directives in the parent .htaccess file being executed.
RewriteEngine On
RewriteOptions inherit
More posts by @Eichhorn148
1 Comments
Sorted by latest first Latest Oldest Best
If the /account subfolder is intended to be outside of WordPress then you can do something like closetnoc suggests, however, you also need to enable the rewrite engine to prevent the WordPress rewrites in the parent .htaccess from taking over.
So, in /account/.htaccess:
ErrorDocument 404 /error.php
# Enable the rewrite engine in the subdirectory to prevent
# mod_write directives in the parent .htaccess file being executed.
RewriteEngine On
Simply enabling the rewrite engine in the subdirectory will prevent mod_write directives in the parent .htaccess file being executed. Since mod_rewrite directives are not inherited by default. In order to "inherit" parent directives you would need to explicitly call: RewriteOptions inherit.
The fact that it's a subdomain doesn't really make a difference in this respect.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.