开发者

How to make Wordpress categories as subdomains without using a plugin?

I was using a plugin called wordpress subdomains 0.6.9 but it has lots of bugs and creating subdomains with this version is risky, I mean later there will be lots of broken links, so is there any way to do this manually, by editing the php code or datab开发者_StackOverflow中文版ase values ? or anything else that will make this work ? and thank you :D


Just an idea: create a wildcard subdomain within your apache config (assuming you´re using apache webserver) and let it point to a php script which redirects acording to the given subdomain.


Are you using Apache2 + permalink? If so, craft some RewriteRule within .htaccess could do it (along with the original permalink).

For example

RewriteCond %{HTTP_HOST} cat1.my.site
RewriteRule ^.*$ /categories/cat1$0 [R]

Or, do 301 redirection

RewriteCond %{HTTP_HOST} cat1.my.site
RewriteRule ^.*$ http://my.site/categories/cat1$0 [R,L]

(Above code is untested so you might want to compare them with doc and test)

http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜