| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Mar 2007
Posts: 460
![]() ![]() ![]() | |
| |
| | #2 (permalink) |
| You are here: X Join Date: Oct 2003 Location: US
Posts: 483
![]() ![]() ![]() ![]() ![]() | I dont' have a host to test this but I off the top of my head, RewriteRule (.*).domain1.com index.php?dn=domain1.com&cat=$1 The above won't work but another solution is possible, grab the sub-domain using php, PHP Code: The above should assign 'test' to $cat using the URL's ww.test.example.com as well as test.example.com
Last edited by mr-x; 05-30-2007 at 07:24 PM.
|
| |
| | #4 (permalink) |
| Danltn.com Join Date: May 2007 Location: Danltn.com / Nottingham, UK
Posts: 1,201
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Hi there, what Control Panel do you use? I have a script which creates email forwarders for Cpanel, which is easily changable to sub domains. Not sure if this is what you want though. |
| |
| | THREAD STARTER #5 (permalink) | ||||
| NamePros Regular Join Date: Mar 2007
Posts: 460
![]() ![]() ![]() | I have Cpanel on Godaddy VPS I should post "domain1.com" in the query, but it's a variable too: (.*).(.*).com Is it possible for htaccess to select the domain name that isn't always the same? ????: NamePros.com http://www.namepros.com/showthread.php?t=333587
| ||||
| |
| | #6 (permalink) | ||||
| You are here: X Join Date: Oct 2003 Location: US
Posts: 483
![]() ![]() ![]() ![]() ![]() |
Here is a cheat sheet for mod_rewrite, http://www.ilovejackdaniels.com/apac...e-cheat-sheet/ for what it's worth, the main problem I've had redirecting multiple domains to one script with mod_rewrite is recursion. I think it's easier to let mod_rerwrite hand the normal stuff like friendly URL's and grab the host header from $_SERVER['HTTP_HOST']. Take a look at http://php.net/parse_url for some examples
Last edited by mr-x; 06-06-2007 at 04:12 PM.
| ||||
| |