SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Dec 2008
    0 Post(s)
    0 Thread(s)

    which techinique is better for dynamic subdomains website


    I am developing a dynamic website which will allow users to create their accounts and have their sites "hosted" using dynamic subdomains - using wildcarded domain.

    In general when user types he will be redirected to his site. The whole site will be using friendly and clean urls.

    Now I found two techniques to achieve this:

    First one described on the ALA website would only use a very simple httaccess redirection to point all requests to the root index.php file and this single index.php file would handle all request by checking the url, splitting it and pointing to some appropriate files.

    Second technique would only use httaccess and mod_rewrite redirections to handle all the requests - not involving any php coding to determine the content user requested.

    Which one is better (faster, less server resources consuming, more usable - when it comes to usability)? Which one should I use? Ill be using a shared hosting for about a year and then after a year if the traffic is on the positive trend (hopefully) id go for a dedicated server...

    I guess this is all about, which way is better to make friendly urls..
    Last edited by malian; Dec 3, 2008 at 11:02.

  2. #2
    SitePoint Addict
    Join Date
    Feb 2007
    0 Post(s)
    0 Thread(s)
    Off the top of my head, I'd use the second method. But then I do more Ruby than PHP these days, and there are issues getting the two to play nice together in some settings.

    The reason I like the second is that it leaves the determination of where to go in the hands of the server, rather than a scripting language. I tend to trust mod_rewrite more than PHP, and only pass the task to PHP when the url needs to be turned into a string of arguments for a query. And, since not everything I do requires PHP, it spares me starting up a php process if it's not needed.

    You could also look into something like mod_vhost_alias, which on first glance at your requirement is a better fit for what you're looking at.

    The big performance hit of mod_rewrite comes with complicated regex processing, so if you keep your regex simple, mod_rewrite will probably work for you, if mod_vhost_alias doesn't work out.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts