Last active
June 21, 2020 16:00
-
-
Save chrisjangl/7c5df36798131d6b0ea6f0289d7031f2 to your computer and use it in GitHub Desktop.
.htaccess to host WordPress in a subdirectory. Some shared hosting won't let your primary domain be assigned to a subdirectory - this will help to get around that.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# replace <domainname> with your domain name | |
# replace <directoryname> with the name of the directory where WordPress is located | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^(www.)?<domainname>.com$ | |
RewriteCond %{REQUEST_URI} !^/<directoryname>/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /<directoryname>/$1 | |
RewriteCond %{HTTP_HOST} ^(www.)?<domainname>.com$ | |
RewriteRule ^(/)?$ <directoryname>/index.php [L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment