Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite, subdomains and wildcards

         

Langers

12:06 pm on Feb 6, 2004 (gmt 0)

10+ Year Member



I am looking to setup a site that will use keyword subdomains in some way and wanted to ask the best way of going about things.

I am able to use wildcards and mod_rewrite. When I set the site up I will also have access to Ensim OR cPanel.

What I would like to do is the following:

manufacturer.domain.com
-> domain.com/index.php?manId=3

category.domain.com
-> domain.com/index.php?catId=12

product.domain.com
-> domain.com/product.php?prodId=24

manufacturer.domain.com/product
-> domain.com/product.php?prodId=24

category.domain.com/product
-> domain.com/product.php?prodId=24

I realise that I will need some way to identify if the subdomain is a category, manufacturer or product but not sure the best way of doing this.

Any advice would be appreciated.

jdMorgan

4:22 pm on Feb 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Langers,

Welcome to WebmasterWorld [webmasterworld.com]!

If you have access to httpd.conf, using the RewriteMap directive of mod_rewrite [httpd.apache.org] will probably be the most efficient approach.

The complexity of implementation will vary greatly depending on how consistently you map your subdomains to your resources. A good, consistent, and "maintainable" plan will pay off over time, so spend most of your time planning, and don't rush into implementation.

Jim

Langers

4:35 pm on Feb 9, 2004 (gmt 0)

10+ Year Member



ok Jim thanks.

What sort of overhead will this put on my server?

I think I have figured out how to do this. I will use the filename to identify the item. i.e:

manufacurerName.domain.com/manufacturer.php
categoryName.domain.com/category.php
productName.domain.com/product.php

I will then just pass in the item name into a database query to get the id.

I would like to be able to expand on this so I can get more keywords in the url. i.e:

manufacurerName.domain.com/productName/product.php
categoryName.domain.com/productName/product.php
and even : categoryName.domain.com/subCategoryName/productName/product.php!

Any idea on the best way of going about this with the method you suggested?

Would this method prove to be more successful than just a keyword rich query string? i.e: domain.com/manufacturerName-ProductName.php or
domain.com/manufacturerName-ProductName/product.php

jdMorgan

5:29 pm on Feb 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Langers,

> What sort of overhead will this put on my server?

Compared to using php? - probably none.

> Would this method prove to be more successful than just a keyword rich query string?

I have no experience in ultra-competitive marketing areas where this kind of complication may be needed. I almost never bother myself with keyword-in-domain or keyword-in-URL techniques except to use good directory and page names when constructing a site. So, I can't speak to the effectiveness of this technique, except to say that most search engines have a limit to how many query parameters they take into account when indexing.

This limit is necessary to avoid getting trapped forever in the potentially-infinite URL-space of a query-driven site. Because of this, static URLs are better, and the best implementations will return 404-Not Found for requests for "pages" which fall outside the normal format and therefore probably don't exist. If your site won't return a 404 for *any* request, then it will likely never be spidered deeply. Only those requests which can be served with a meaningful response should return 200-OK. Those for which there is no database entry must not.

Jim