WordPress Subdomain Plugin
Subster Rejuvenation v.021 is a WordPress plugin that turns your categories into subdomains. We are now running it on this site. I’m sure there might be a couple of bugs, so post comments if you find any.
Update 1-28-06
v0.21 is a major rewrite. Here’s a list of the new features:
- Sub categories are now nested properly. So urls will look like http://maincategory.domain.com/subcategory/post/
- You can now make subdomains out of static pages. Sub pages will also be nested the same way sub categories are.
- You can now tie a static page to a category subdomain. http://maincategory.domain.com/staticpage/
- You can now use separate themes for individual subdomains.
The only real downside of v0.20 is the fact that it is now no longer compatible with WP 1.5. If you want to run this version, you will need to upgrade to WP 2.0
Update 1-16-06
I’ve just uploaded the latest version. You can now select which categories you want to be converted to subdomains by checking a box on the edit category page. Unfortunately, this feature only works with WordPress 2.0.
Update 1-13-06
I think we now have all the login/cookie issues resolved. Everything seems to be working smoothly. The last thing I think we’ll add is the ability to pick and choose which categories you want to convert to a subdomain.
Update 1-11-06
It looks like we’ve fixed all the bugs mentioned so far. Once you install it, all of your current links (including your feed and comments) should be rewritten to the appropriate subdomain. It also handles all the 301’s for your old urls, so you don’t need to spend anytime worrying about links out on the web. (I just checked Dave’s site and his links to this site all work).
Also, I forgot to mention in the initial post that you need to have wildcard dns enabled for this plugin to work. I’m not a big fan of doing that, because it can lead to duplicate content issues, so we added a default 301 for any subdomain that isn’t a real category.
Beyond that, the only other issue we’ve seen has to do with cookies. If you are logged in, it will appear that you are logged out when you move from category to category. We should have that worked out tomorrow.
Comments
77 Responses to “ WordPress Subdomain Plugin ”
Got something to say?
tried to do pet search and i keep getting error page
From front page/category archive permalinks point at subdomain, but the “Comments” link and ‘Read more’ link point to the main domain not the subdomain.
Feeds point at main domain not subdomain
An interesting problem with this - RSS Readers now think that every one of your posts is new, so I get to re-read all of your older posts (well, 10 duplicates anyway). Just food for thought depending on how many posts are in your RSS feed.
Thanks for the feedback. I’ve turned it off for now. We’ll get these bugs sorted out and post a new version shortly.
That explains why I got another copy of those…
I’m sure you’ll have it fixed before we get to New York. It’s a cool add-on, and I can’t wait to see it fully functional.
[...] I wrote this for work, so here’s the link for it on the Webguerrilla’s blog. [...]
this plugin has great potential, thanks.
Sounds like a great plug-in. I definitely plan on using it.
Could you point to some tutorial(s) on how to set up wildcard DNS?
Hi Bill,
You would need access to the zone file of dns server. All it involes is creating an A record that uses an “*”
Quite a few web hosts provide a control panel to edit your dns information. If they don’t, you should be able to email them and have them do it for you.
Wow, very cool, I like where this plugin is going. Example, I have a blog on rainwater harvesting but want to do a biodiesel, solar power and a few other different subjects on subdomains. To do this I currently have to have a unique wordpress password for all and setup the wordpress software which have their own databases. Does this plugin allow you to do it all from one?
wow. I did not realise I have to modify the DNS entries. Anyway, I might put this on my site later at itechtips.com
Hi Greg! nice idea and use of the wildcard DNS!
wrote on it here
I haven’t looked at it close enough, but do you have a way in it to overcome duplicate-content attacks for the wildcard-DNS thingie?
cheers,christoph
Yes, the plugin prevents the site from returning any subdomain that doesn’t match a WP category. If one is requested, the server returns a 301 to the home page.
Here is an example you can test:
http://test.webguerrilla.com
Any advice on implementing the plugin and converting an existing site with subdomains to a single install of wordpress using the plugin.
We currently have 10 different installs of wp running on our 10 different subdomains. If we understand the plugin correctly, we could change everything to the root install and nominate categories as subdomains but what about the post already in those various databases?
Also, do subcategories of the nominated subdomain show up as normal categories on the subdomain?
Merging 10 databases would be tough because you would have a bunch of duplicate ID’s. I would imagine it could be done, but it would take a bit of work.
If you were successful at creating a singe database, then you could run this plugin and get the same basic effect. Although, at this moment the plugin doesn’t nest subcategories the way you want. But we’re taking a look at doing it in a future version.
As far as showing on the subcategories goes, I’m pretty sure Wordpress can do that on its own by showing only the child categories when viewing a parent category.
Haven’t figured out the merging databases part yet. Thinking about importing the other databases to the single database with a couple of other plugins used to combine two installs.
Keep working on this one. This is a much needed plugin for a ton of people.
any idea why we get this syntax errory:
WordPress database error: [You have an error in your SQL syntax near 'ON DUPLICATE KEY UPDATE not_subdomain='1', cat_template=''' at line 1]
INSERT INTO wp_subster_rejuvenation (cat_ID, not_subdomain, cat_template) VALUES (’5′, ‘1′, ”) ON DUPLICATE KEY UPDATE not_subdomain=’1′, cat_template=”
Did you upgrade the plugin when this started happening?
If so, Deactivate and Reactivate it to ammend the database. You have an old version that uses cat_template, so you should probably upgrade, deactivate, reactivate, either way.
If that doesn’t help, when is this error popping up? When you edit a category?
thanks
I’ve updated, deactivated, reactivated, deleted, reinstalled and I still get the error when editing categories.
I’ve inserted the info manually via sql statment and can only get it to go without the “ON DUPLICATE KEY UPDATE” portion of the statement. The only statement that works is INSERT INTO wp_subster_rejuvenation (cat_ID, not_subdomain, cat_theme) VALUES (’3′, ‘0′, ”). If I throw in ON DUPLICATE KEY UPDATE not_subdomain=0, cat_theme=” manually in a sql statement I get the syntax error. Could this be a problem with sql instead of the plugin? Sql version is MySQL 3.23.58
Sub-cats are not nesting for me like your example, i.e. cat/blog/sub-cat/post. Instead I get the sub-cat as a new sub domain, sub-cat/blog/post.
The error should be different at least. cat_template shouldn’t be in it at all anymore.
I’m escaping the dB strings now. That might help. Try the new one.
I can’t seem to reproduce the error. Any more information — like what you’re changing or adding when it happens, would help.
Using v.023
The error is now cat_theme consistent with your change.
Error: #1064 - You have an error in your SQL syntax near ‘ON DUPLICATE KEY UPDATE not_subdomain=0, cat_theme=”’ at line 1
Note: I can’t manually enter the sql statement in the database either. I have to leave off the above code to get sql to accept it.
The message appears each time I attempt to edit a cat. From wp-admin: manage/categories/edit/edit categories/error message.
Even when I manually add the sql statement, the sub-cats are not nested. Sub cats show on their own sub domain.
Giggidy Googidy, you got it.
I changed the update code to make it compatible with MySQL
oops. I just learned what the code tag is for.
I changed it to work with MySQL less than 4.
Also. If you’re not getting child categories as sub directories under their parent category subdomains, try editing a post in each of the offending child categories. Just edit it and save it. It doesn’t make sense, but that fixed a similar error I saw on someone else’s blog.
that took care of the mysql error message and the trick about adding a post and editing for the offending category/sub-category caused the sub-cat to nest correctly. Now showing category/blog/sub-category/post, however, the url now 404’s.
Does it 404 on the posts you edit as well?
If editing the posts fixed it, something might be messed up inside your Wordpress install already. I wasn’t able to figure out why that fixed it the first time. It’s not a beta version is it?
The problem is that your rewrite is showing the sub-category in the url. category/blog/sub-cat/post gives the 404, if I take out the sub-cat and call it with category/blog/post, no 404.
My true permalink structure is date and time based (http://blog.com/2006/01/30/sample-post/). The sub-category showing in the url is definitely giving the 404.
I was able to take care of the 404’s by removing the sub-category from the rewritten url only.
I changed line 561 to:
$link = “http://”.$this_category->category_nicename.”.”.$blogurl.”/”/*.$kid_string*/.$append;
Okay done.
Get the new one. You can have whatever permalink structure you want.
Hmmm… I still get error 404s for my site. I thought it was file permissions with my .htaccess. Could it be theme related?
Using next_post in a template gives you the active post instead of post + 1. Turn off the plugin and everything is back to normal. Any ideas? Sick of us yet? This is what you get for creating one of the most fundamentally cool plugins to come along since “Hello Dolly”!
Yea that was a bug. Try the new version. You have to replace the next_post and prev_post functions with the following though:
sd_previous_post_link('« %link', '%title', true);
sd_next_post_link('%link »', '%title', true);
That worked for me. Lemme know.
And thanks.
404 errors: I don’t know what could be causing that. The plugin doesn’t access the .htaccess file exactly. Wordpress 2 did away with that file completely and uses a mod-rewrite/regex engine type deal internally. Is everything
I keep getting the following error upon editing category / assigning theme for a category:
Is this a matter of mysql version compability?
sd_previous_post_link and sd_next_post_link worked fine.
But guess what? For some reason after uploading the latest version .27, the latest post will not show a title or a category on the single post pages only and on the very first post in my database (single post page only, categories look fine), I get this sql error:
WordPress database error: [You have an error in your SQL syntax near 'ORDER BY post_date ASC LIMIT 1' at line 1]
SELECT ID,post_title FROM wp_posts INNER JOIN wp_post2cat ON wp_posts.ID= wp_post2cat.post_id AND (category_id = 0) WHERE post_date > ” AND post_date
Gilad G.:
I had the same error and I do think it has to with Mysql version.
Here’s how I get around it: Go into Mysql and manually add the category number to the subster table. Once the table has been created manually, you won’t have any problem modifying the table from inside wordpress.
Definitely found your bug tommy.
Gilad, I took out the ON DUPLICATE KEY call entirely. Early MYSQL doesn’t support it. Try the new one.
Squish. Good job, like pesticide.
Can’t read this page. Black text against black background? Not sure where you’re going with that.
Thanks Dax, works good now.
Next problem, when using sub-sub-category. That is Category2 with Category1 as parent (not root), the only permalink structure which works is http://www.someblog.com/?p=123 anything else gives a 404 (I tried the ones listed as well as a custom /%postname%/ ).
Thanks again…
Hey Greg,
somehow I didn’t get a mail notice about your reply on
http://tools.webguerrilla.com/wordpress-subdomain-plugin/#comment-430
for your cool plugin…
What I see currently is that whenever I link or click to
http://test.webguerrilla.com/
http://cemper.webguerrilla.com/
http://kill-gregs-site-with-duplicate-content-subdomains.webguerrilla.com/
is that you return me your main index page, not a 301 as designed…-
I’d fix that ASAP
cheers,Christoph
This is a followup to comment #39.
I had just ran into pages here and here which I believe to be doing what I’d like to achieve: http://some-cat.mysite.com/subcat1/post-name/ …
Any suggestion as to how should I form my permalink?
I think if you use the /%postname%/ permalink structure you can duplicate the webguerrilla.com results. That’s what I use on my site.
Ok, I was the one that asked earlier with the error 404 I was trying on here.
Now I just made a new, fresh installation. It is here. This WP is a fresh install. Nothing on it. Just added the K2 theme. Then installed this plugin. If you try clicking on Hello World, it does not work already. What could be my problem? Also something to note probably is, I used Fantastico to install WP. Help please.
Or maybe I just do not know what to do with these:
$sr_redir_wildcards = TRUE;
$sr_cat_marker = “category/”;
$subdomain_page_metakey = ’subdomain_me’;
$tie_page_metakey = ‘tie_to_category’;
$page_theme_metakey = ‘page_subdomain_theme’;
Greg, Dax, someone… what am I doing wrong? I just did a fresh install, this time, not via Fantastico scripts installer. Just did the install WP from scratch. Do I need to change anything in the parameters in the plug posted above? Thanks in advanced.
Still won’t work
now i’m thinking, this is a cPanel issue.
Do you have wildcard dns enabled? The plugin won’t work without it.
I finally got it working.
sacredheartacademy.net
Nothing on that site. Just plain Kubrick, fresh WP install with zero content.
Click and uncategorized.sacredheartacademy now working.
I started messing around with the DNS records and could not do much with it. And it just made if forward to the server main account, since I have sites on a shared IP.
So I just added a subdomain using the cPanel subdomain function, did SSH, logged in as root and opened up the httpd.conf. Looked for the entries that made the subdomain and changed it to *. And presto, it works.
Thanks. And for my clients that do not use Wordpress, I might do the same, wildcards, (but I think in my case it is not really wildcard DNS, but wildcard server alias) and just have PHP read the URL to have dynamic content if needed.
This is a followup to comment #39 & #41.
For some odd reason I cannot get this to work
this is what I did: Installd a clean installation on a clean domain & uploaded the plugin. Created a new category with parent “Uncategorized”, and edited the “Hello World” post to belong to the new category. Lastly, I set permalinks to /%postname%/.
I now have http://uncategorized.myblogs.com/sub-cat/ and http://uncategorized.myblogs.com/sub-cat/hello-world/ both return a Wordpress “Error 404 - Not Found” page.
Can this be something with my host?
Hi,
I have to say that this is a very nice plugin. However, certain problems appear when it used in tandem with the Google Sitemaps plugin. The problems are actually with the sitemap file generated - they start to contain entries from different subdomains which is not acceptable to google. Me and my friend Benj Arriola thought about it so I wrote a short script that works around this problem.
You can see the script here:
http://search-engine-optimization.mikelopez.info/2006/03/02/google-sitemaps-and-wordpress-subdomain-plugin/
I hope it works for you!
Mike Lopez
Gilad,
What’s the content of your .htaccess file? It could be that your .htaccess file’s contents is incorrect.
Mike
Hmm, it is rather small compare to all my other installations:
# BEGIN WordPressRewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Am I missing something?
Just wrote a small quick how-to that may help people using this plug-in on CPanel servers. Enabling Wildcard DNS on CPanel Servers
I’ve had some real problems with this plugin, although I have been learning a lot! I have edited my httpd.conf (thanks benjarriola) and got the wildcard DNS running OK. Links such as:
http://collections.mysite.net/newport-news-brands/?p=73
work OK, but
http://collections.mysite.net/newport-news-brands/
does not.
Any ideas anyone? Also, anything other than default permalink structure wonk work at all. Something to do with .htaccess?
Thanks in advance, pilks.
I was running Wordpress 2.01, and I recently did an update to Wordpress 2.02 using Fantatisco script installer inside cPanel. Subdomain plugin was disabled.
I tried disabling and enabling, still won’t work. Anyone with problems with the subdomain plugin after upgrade to Wordpress 2.02?
Hi Pilkster, is your .htaccess file set to file permissions 777? If not, Wordpress cannot edit it when you change the permalinks.
Hi Benj - yep, .htaccess set at 777. No problem changing the permalinks. Can you think of anything else?
“You would need access to the zone file of dns server. All it involes is creating an A record that uses an “*”
I sent an email to my host asking them to enable wildcard DNS but they didn’t know what I was talking about. There is a DNS tab in my ops panel with an “address A” row. There is a blank box under three “Hostname” entries. Is this where I put an “*” and then click “add address”?
Thanks, Garrett
Wildcard DNS working. Plugin works but every page shows the same post from the homepage. How can I get this to stop and have the correct text appear for each page?
Thanks, Garrett
I have the same problem like ge (59) and problem from 40-th comment. Wildcard DNS enabled, links to single posts work but categories links don’t work. They lead to the same main page. How can I fix this problem? Thanks.
I like the ideal of this plugin very much! But it didn’t worked out for me. Just a short question. Gilad posted a .htaccess File. Is this a correct one? Mine looks like this:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Thank you!
Finally my provider managed to set the wildcard-settings but now I have a problem concerning my existing subdomains on that domain. If I call them they are all pointing now to my wordpress blog. Like: http://wohntraum.4uu.net
Is there a possibilty to keep the old subdomains intact? Maybe a little tweak in the htaccess?
Maybe another issue: When I click on a Category-Link I get *all* articles (and not only the articles from the choosen category).
See it on http://www.4uu.net/
Thank you very much and kind regards from Vienna
Andreas.
Think I might be able to solve all your problems. Get over to Dax’s blog and download version 0.30. My life is much richer with a working version of this plugin in it.
http://wordpress-plugins.biggnuts.com/wordpress-subdomains-plugin/
Come on monkey, get this thing updated!
Subdomene plugin til Wordpress…
WebGuerrilla har laget en plugin for Wordpress som gjør om kategorier til subdomener. Jeg vet ikke helt om den fungerer med underkategorier, men hvis den gjør det kunne jeg gjerne tenkt meg å implementere den både her og på Søkebloggen.
Last ned……
Wooohooo, finally got the plugin to work after I got my host to manually add wildcard:
http://www.norwayblogger.com/
Kim
Hey I got the plugin working (sort of). It will work if I type in a subcatagoryname.voice2connect.com but if I just go to voice2connect.com it doesn’t work but http://aviation.voice2connect.com/ works
Any ideas? I thought .htaccess was messed up, but looks good to me.
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
order deny,allow
deny from all
allow from all
order deny,allow
deny from all
AuthName http://www.voice2connect.com
AuthUserFile EDITEDFORSECURITY/service.pwd
AuthGroupFile EDITEDFORSECURITY/service.grp
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
-brad
i was inspired by this great plugin to start and create my very own first wordpress plugin. i call it the ‘themed categories’ and it allows you to assign themes to each category much like the subdomain plugin does. thanks to greg and dax for this great plugin!
p.s. is there any way to allow filtering of urls and directories in bloginfo? i checked the bloginfo code and it explicitly disallows it so i have to hack it a bit. any easier way?
thanks again!
Hi there,
This sounds like a cool plugin, and just what I need for total world domination!
Ok, maybe that’s a bit much, but thanks for the plugin. I’m usually pretty able to install stuff, but I have no idea where to find this text:
$sr_redir_wildcards = TRUE;
$sr_cat_marker = “category/”;
$subdomain_page_metakey = ’subdomain_me’;
$tie_page_metakey = ‘tie_to_category’;
$page_theme_metakey = ‘page_subdomain_theme’;
I see in the php file, it says I have to modify these things somewhere…but I looked all around the admin area in all the places, and I was unable to find where to modify this in my installation.
By the way, I have the wildcards set on my host, blah, blah, blah. Just need to get this badboy running.
Thanks!
brian
I activate you plugin on WP 2.0.4 but is not worked!
Links transform to subdomain but IE give me error 404!
Help me, please
Thanks you for all.
forgive me for my english
I got an error updating a post after I upgraded to WP 2.1:
WordPress database error: [Duplicate entry '0' for key 1]
INSERT INTO wp_subster_rejuvenation (cat_ID, not_subdomain, cat_theme) VALUES (”, ‘1′, ”)
Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/public_html/wp-includes/wp-db.php:121) in /home/XXXX/public_html/wp-includes/pluggable.php on line 275
I replicated this on two different sites, but same server.
Did you have this problem yourself, Greg?
What is the latest version here?
If I download from this page, the version number is: 0.030. The version I have used is: 0.035, but that one was downloaded earlier.
I tried changing the version, but the error still happens when I edit an existing post.
It seems the plugin is updated over here:
http://wordpress-plugins.biggnuts.com/wordpress-subdomains-plugin/
Hi, just wondering if this plugin is/will be updated (for 2.3x?).
Also, it seems that you’ve turned off the plugin for this blog.
Any reason why?
Thanks.
~The SEO Blogger~
Seems my subdoamin doesn’t have an RSS feed… any ideas?
http://video-game.review-it.info
I’d really like to get this plugin for my site, but the download link above is not working and neither are the alternative download links in the comments. Anywhere that I can get a recent copy of this plugin?
Hi Jaime,
Unfortunately, we no longer support the subdomain plugin. It stopped working a couple of updates ago, and since a stopped using it on this site, in ended up on the back burner. We’re so busy right now with client work that I don’t think we’ll get to it anytime soon.
i need this plug-in.. link is closed, can u replace ??
thanks a lot..