I have one site with wordpress that have blog page.
So now for this page Url is somthing like http://abc.com/blog .
But i want to convert this url to http://blog.abc.com
I added code in .htaccess file but rewrite is not working. Rewrite mode is also on in apache.
Any one have idea how to change this url ?
I want to test in my local wamp first, so please give suggestion with localhost too, if possible.
Code is that i tried
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^abc\.com/blog [NC]
RewriteRule http://blog.abc [R=301,L]
Your rule needs to look something like:
RewriteCond %{HTTP_HOST} ^abc\.com$ [NC]
RewriteRule ^blog/(.*)$ http://blog.abc.com/$1 [R=301,L]
the %{HTTP_HOST}
variable is only the hostname, and no path information is part of it (eg /blog
). The RewriteRule
takes at least 2 parameters:
RewriteRule <pattern to match against the URI> <if matched, rewrite/redirect to this URL> <flags>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.