SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard Sillysoft's Avatar
    Join Date
    May 2002
    Location
    United States :)
    Posts
    1,691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mod rewrite to have domain name resolve to a page

    I want to have a subdomain point to a specific page on the parent domain. For example, I want companyname.domainname.com to point to www.domainname.com/business-category/company-name/1234 but the url still shows companyname.domainname.com. Is that possible with modrewrite? And if so how? And how would that affect the indexing of the page when it comes to search engines?

    Thanks!
    Silly

  2. #2
    SitePoint Wizard Sillysoft's Avatar
    Join Date
    May 2002
    Location
    United States :)
    Posts
    1,691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well after searching the forum looks like I was using the full url in the mod rewrite rather then /

    Code:
    RewriteCond %{HTTP_HOST} ^([^.]+)\.companyname\.domain\.com$ [NC]
    RewriteRule ^$ /pathtopage [L]
    My question is how does this affect search engines picking up the website? Will it pick it up as companyname.domain.com or the pathtopage?

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    ss,

    SE's will only see the requested path-to-page because that's what the visitor will see (NO R=301 or absolute redirect).

    As for your original question, you COULD use dynamic mass virtual hosting (see apache.org for that) and redirect to the directory assigned to this, er, page. Then make that directory's DirectoryIndex the page you want to serve. Too convoluted for me, though, and you WILL have major difficulties with "support file" relative links.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  4. #4
    SitePoint Wizard Sillysoft's Avatar
    Join Date
    May 2002
    Location
    United States :)
    Posts
    1,691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    ss,

    SE's will only see the requested path-to-page because that's what the visitor will see (NO R=301 or absolute redirect).

    As for your original question, you COULD use dynamic mass virtual hosting (see apache.org for that) and redirect to the directory assigned to this, er, page. Then make that directory's DirectoryIndex the page you want to serve. Too convoluted for me, though, and you WILL have major difficulties with "support file" relative links.

    Regards,

    DK
    All I need it to do is have companyname.domainname.com load that one single page that already exists on the parent domain. I just need the url to show companyname.domainname.com.

    The parent domain, domainname.com, has listings of each company with their company information. Each listing has a url format like www.domainname.com/business-category/company-name/1234. But instead of typing that all in manually I want companyname.domainname.com to resolve to www.domainname.com/business-category/company-name/1234 but with the url still showing companyname.domainname.com.

    So just need to show that one listing page for that particular company, all the links/images/files etc will just be the same as if they went to www.domainname.com/business-category/company-name/1234 directly.

  5. #5
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    ss,

    I understand what you're trying to do but you need to understand that a subdomain is, in reality, another domain and the multiple (sub)domains that you are attempting to use is NOT a trivial matter. Apache's mass dynamic virtual hosting makes it possible BUT you must establish a DocumentRoot for each of these (sub)domains. DocumentRoot is NOT a file but a directory and THAT is the location for you to attempt to use your mod_rewrite code (and fix the relative links 'cause they're be relative to the NEW DocumentRoot - which, in your case, should be the main domain's DocumentRoot).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

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