ModRewrite user@example.com to user.example.com?


#1

Hi

Is it possible to redirect or rewrite a url like http://user@example.com to http://user.example.com ?

I was thinking about using modrewrite for that but all my attempts failed…

The reason I want this is because then I can use my email address as my website address.

Simon Menke


#2

Unfortunately that won’t work, as the “@” sign is not allowed in a “.com” domain name (which is what is to the left of the period that proceeds the “TLD” (Top Level Domain). in a “.com” domain, the TLD is “com”. :wink:

While there are some variations of the rules for special domains (local intranets, certain TLD’s, etc.), general rules for the most common domains are as follows (excerpted from a FAQ on Verio UK):

[quote]The only characters allowed in a Domain Name are the 26 letters of the English alphabet, numbers 0-9, and hyphens (-). A domain cannot begin or end with a hyphen, but it may contain one or more hyphens. You may use up to 63 characters plus the gTLD (generic Top Level Domain: .com, .net, and .org) as part of the Domain Name. Each ccTLD (country code TLD) Registry has its own restrictions on the length and format. Domain Names are not case sensitive and are usually displayed in all lowercase. You may, however, use capital letters to emphasis words in your Domain Name, like: DavysKitchen.com

Rules for domain names

  • domain names cannot contain spaces or other punctuation, they may only contain letters, numbers, or dashes ("-").

  • UK domain names cannot be just 2 letters (ie. ab.co.uk is not allowed), 2 character domain names eg. 3x.co.uk are permitted.

  • domains cannot begin or end with a dash

  • cannot have more than 63 characters (excluding the domain name ending - .com, .net, .org, .co.uk).[/quote]

–rlparker


#3

Can’t be done by definition

Quoting:
"Reserved:

Many URL schemes reserve certain characters for a special meaning:
their appearance in the scheme-specific part of the URL has a designated semantics. If the character corresponding to an octet is reserved in a scheme, the octet must be encoded. The characters “;”, “/”, “?”, “:”, “@”, “=” and “&” are the characters which may be reserved for special meaning within a scheme. No other characters may be reserved within a scheme.

Usually a URL has the same interpretation when an octet is
represented by a character and when it encoded. However, this is not true for reserved characters: encoding a character reserved for a particular scheme may change the semantics of a URL.

Thus, only alphanumerics, the special characters “$-_.+!*’(),”, and reserved characters used for their reserved purposes may be used unencoded within a URL.

On the other hand, characters that are not required to be encoded (including alphanumerics) may be encoded within the scheme-specific part of a URL, as long as they are not being used for a reserved purpose.

http://www.faqs.org/rfcs/rfc1738.html RFC1738


#4

but in the user part it is.
i can write user:passwd@domain.com
and i can (i think) omit the ‘:passwd’ part leaving me with user@domain.com
modrewrite can look at the user value with ${REMOTE_USER} or ${REMOTE_IDEN} i think…

Simon


#5

Simon, I [ibelieve that the “user” part you are referring to is possibly part of a url that facilitates an ftp connection, rather than an http connection, and that mod_rewrite for apache only handles http requests.

I’ll have to research it a little more, but I think that may be the issue with trying to do that with mod_rewrite.

–rlparker


#6

Alright i’ll continue reading then …

thanks anyway
Simon


#7

You raise a good point, and I’m reading too! :wink: . While I’m still reviewing docs on the Apache site, the only uses I have found that employ the “@” character in re-writng in the Apache Apache 1.3 url re-writing guide have to do with proxies, and special authentication, and require that mod_proxy be loaded before mod_rewrite in th httpd.conf file for the server.

In the rewrite guide for Apache 2.0, and the advanced re-writing guide is similar information.

You can see the modules that are currently installed on Dreamhost Apache 1.3 and 2.0 servers in this prior post. As you can see, mod_proxy is not installed oin either Apache configuration.

I just don’t think that re-write is going to work. :frowning:

–rlparker


#8

Even if you could, I think most people would see it as a typo on your part and drop the user@… which kinda says that if someone knows your email address, they’ll likely figure out how to get to your site.

Not to mention, if a person clicks on a link that says user@example.com in it, he probably wants to email you and will expect his default email program to handle the link.

It’s like when people do the opposite and break their own email address by putting www. in front of it. I get a bunch of those (usually from AOLers – www.someone@aol.com), so I have to remove the www to reply. I’ve had maybe one or two of those where the www belonged there, but it’s usually in the form of a full domain name, like www.example.com@gmail.com.


:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.


#9

I must say I agree. never thought of that.

Simon