Writing a URL redirect for my blog
-
I have a wordpress site with a number of sub domains set up e.g
my main site is https://www.mysite.com and I also have search.mysite.com
and blog.mysite.com. At the moment all the subdomains just point to my main site.I have a category set up on my blog that contains articles purely written by myself and they are currently accessed from the category URL https://www.mysite.com/myarticles.
What I want to do is add a rewrite rule to my htacess file so that
blog.mysite.com points to https://www.mysite.com/myarticles and the user believes they are on a different sub domain even though its just a pointer to a category on my site.I can do a Redirect rule at the moment with
RewriteCond %{HTTP_HOST} ^(blog\.)?mysite\.com
RewriteRule ^(blog\.)?mysite\.com/?$ /myarticles/ [NC,L]and
RewriteCond %{HTTP_HOST} ^(blog\.)?mysite\.com
RewriteRule ^(blog\.)?mysite\.com/?$ /myarticles/ [R=permanent,L,NC]but they just point to my main site https://www.mysite.com with that URL in the address bar
and
RewriteCond %{HTTP_HOST} ^(blog\.)?mysite\.com
RewriteRule ^(.*)$ /myarticles/ [L,NC]gives a 500 status code redirect loop error
and
RewriteCond %{HTTP_HOST} ^(blog\.)?mysite\.com
RewriteRule ^(.*)$ https://www.mysite.com/myarticles/ [R=permanent,L,NC]Takes me to the right page but shows https://www.mysite/myarticles in the address bar and not blog.mysite.com which is what I want.
I dont want to set up separate folders on my webserver with virtual domains etc if possible as the content is all going to run off the same database and wordpress folder.
Can anyone help me with the htacess rewrite rules that I will need to mask my category URL with my blog subdomain. I want to be able to use blog.mysite.com as my links.
Any help would be much appreciated.,
Thanks
- The topic ‘Writing a URL redirect for my blog’ is closed to new replies.