• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4058
  • Last Modified:

blogs.site.com/blogname to blogname.site.com... How?

I'm looking for ideas or solutions to the following...

I have a multi-blog system where people access these blogs through a URL like: blogs.site.com/blogname
Using mod_rewrite that URL redirects to blogs.site.com/index.php?blog=blogname
index.php and all the associated files are stored under /www/site.com/blogs/ and I would prefer to keep them there if possible.

The above works fine, but we are now forced to change our URL structure to blogname.site.com instead (or blogname.blogs.site.com would be fine too). blogname is dynamic and as a first step I setup wildcard dns so anything.site.com does work. It just pulls up site.com by default.

So any ideas on how to accomplish that? I tried blogname.site.com and using mod_rewrite was able to redirect those requests to blogs.site.com/blogname but the problem with that was mod_rewrite sees them as different sites so won't transparently redirect them and changes the URL in the address bar I assume as a security thing. The URL cannot change.
  • 3
1 Solution
And your wildcard subdomain blogname.site.com points to which folder? /www/site.com/? Or how did you configure the virtual host?

Do you've access to the httpd.conf or are you forced to use per-dir configuration files (".htaccess")?
nsandenAuthor Commented:
Thanks for the response.

regarding blogname.site.com I edited the hosts file for site.com and added a line like:
*       IN      A       IPADDRESS

I have access to httpd.conf and anything else on the server.
nsandenAuthor Commented:
The virtual host does go to /www/site.com/

 ServerAlias *.site.com
 DocumentRoot /www/site.com

Perhaps it should go to /www/site.com/blogs/ and add another virtual host for www.site.com before it?
nsandenAuthor Commented:
Okay now i'm feeling stupid. That was rediculously easy. Working great now after pointing *.site.com to /www/site.com/blogs/

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now