I set the CNAME of my subdomain below:
blog.mydomain.com
to my wordpress installed in the /blog/ folder under the root directory.
Previously, I needed to use this url to call wordpress:
http://blog.mydomain.com/blog/
what is ugly. I tried a lot of redirect code:
http://blog.mydomain.com/
to a folder so that I can use it as my wordpress url.
Finally, I got a .htaccess setting that works:
RewriteEngine On RewriteCond %{HTTP_HOST} ^blog\.mydomain\.com$ RewriteCond %{REQUEST_URI} !^/blog/ RewriteRule (.*) /blog/$1
I have another CNAME subdomain: http://forum.mydomain.com to install mybb in the /forum/mybb/ folder, so .htaccess needs to be placed [L] in each of the RewriteRule code, as shown below.
RewriteEngine On RewriteCond %{HTTP_HOST} ^forum\.tophyips\.info$ RewriteCond %{REQUEST_URI} !^/forum/mybb/ RewriteRule (.*) /forum/mybb/$1 [L] RewriteCond %{HTTP_HOST} ^blog\.tophyips\.info$ RewriteCond %{REQUEST_URI} !^/blog/ RewriteRule (.*) /blog/$1 [L]
If you want to use the code, please remember to include the URL address of the URL and the cookie in the application configuration file, following the setting to ensure the correct redirection.
hyip Mar 31 '15 at 8:11 2015-03-31 08:11
source share