I’m trying to figure out if its possible to write a domainname in the url and use this as an variable with mod_rewrite?
Here is how I want my url:
I have tryied with this but no luck:
RewriteRule ^website/([a-zA-Z0-9_-]+)(/([a-zA-Z0-9_-]+))?$ website/index.php?site=$1 [L]
Can this be done?
Thanks in advance
I still havent found an solution… Any ideas anyone?
Why do you want this? You know PHP has $_SERVER[‘HTTP_HOST’], right?
Where’s the beef? Oh, yes, where’s the dot for your newdomain.com (second atom)?
Yes, it can be done so long as you add an escaped dot in the second atom’s character range definition.
Your “include a URL” scared me for a moment because many people try to add http:// to that which is adding ILLEGAL characters (restricted from use within a URI) - as you were not doing that, yes, of course, you can do just about anything with mod_rewrite.
Rémon - he was asking about a NEWdomain in the URI, not the current domain ($_SERVER[‘HTTP_HOST’]}) but why would you bring PHP into the Apache discussion anyway?