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 database values ? or anything else that will make this work ? and thank you :D
Asked
Active
Viewed 4,766 times
2 Answers
2
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.

Tobias
- 7,238
- 10
- 46
- 77
-
That is interesting - but how would such a script work ? what would it check for ? – Obmerk Kronen May 04 '15 at 18:54
-
Compare to this post: https://stackoverflow.com/questions/18539141/how-do-i-get-htaccess-to-redirect-from-wildcard-subdomain-page-to-wildcard-subd – Tobias May 05 '15 at 06:46
-
The redirect is understood and easy.. the php script part was my comment subject.. – Obmerk Kronen May 08 '15 at 03:47
-
1The script would extract the called URL from the HTTP request, you can parse this URL then and do whatever you like to do :) See https://stackoverflow.com/questions/5292937/php-function-to-get-the-subdomain-of-a-url – Tobias May 11 '15 at 07:06
2
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)

timdream
- 5,914
- 5
- 21
- 24