Created
December 6, 2015 07:07
-
-
Save bunnywong/943b817ca0033e6d22ab to your computer and use it in GitHub Desktop.
Example of sub folder as root URL at Wordpress - lowb.me
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
# 1. This .htaccess located in root level | |
# 2. Wordpress source in '{root}/lowb.me/public' | |
# 3. Add below in wp-config.php | |
# define('WP_HOME','http://lowb.me/lowb.me/public'); | |
# define('WP_SITEURL','http://lowb.me'); | |
# Ref: | |
# http://marktyrrell.com/2012/09/installing-wordpress-in-a-subdirectory-running-it-from-the-root-directory/ | |
# Turn on rewrites. | |
RewriteEngine on | |
# Don't apply to URLs that go to existing files or folders. | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
# Only apply to URLs that aren't already under /lowb.me/public | |
RewriteCond %{REQUEST_URI} !^/lowb.me/public/ | |
# Rewrite all those to insert /lowb.me/public | |
RewriteRule ^(.*)$ /lowb.me/public/$1 | |
# Redirect the root folder. | |
RewriteCond %{HTTP_HOST} ^(www.)?lowb.me$ | |
RewriteRule ^(/)?$ wp/ [L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment