What is MIME type "text/x-url"?
A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.
text/x-url is a MIME type for Internet Shortcut files. These files are plain text and hold a website address. They typically include a header (often “[InternetShortcut]”) and a line pointing to the URL. The format lets users open a webpage with one click.These shortcuts are mainly used on Windows to create easy access points to online resources. They are stored as text, making them simple to edit or share. The associated file format is represented by the extension URL.
- Quick launch to web addresses
- Easy customization and sharing
- Common in desktop and start menu shortcuts
Associated file extensions
Usage Examples
HTTP Header
When serving content with this MIME type, set the Content-Type header:
Content-Type: text/x-url
HTML
In HTML, you can specify the MIME type in various elements:
<a href="file.dat" type="text/x-url">Download file</a>
Server-side (Node.js)
Setting the Content-Type header in Node.js:
const http = require('http');
http.createServer((req, res) => {
res.setHeader('Content-Type', 'text/x-url');
res.end('Content here');
}).listen(3000);
Associated file extensions
FAQs
What is the text/x-url MIME type used for?
The text/x-url MIME type is primarily used for Internet Shortcut files, which typically have the extension .url. These are plain text configuration files used by the Windows operating system to redirect a user to a specific website when the file is opened.
How do I create a valid text/x-url file manually?
You can create one using a standard text editor like Notepad. The file must be saved with the .url extension and contain the following INI-style format:
ini
[InternetShortcut]
URL=https://mime-type.com
How do I configure Apache or Nginx to serve .url files?
For Apache, add the line AddType text/x-url .url to your .htaccess or configuration file. For Nginx, include text/x-url url; inside the types block of your nginx.conf or mime.types file to ensure the correct Content-Type header is sent.
Will a web browser automatically redirect if I link directly to a .url file?
No, most web browsers will not execute the redirect defined inside the file. Instead, the browser will likely display the raw text content of the file or prompt the user to download it. The redirection logic is handled by the operating system (specifically the Windows Shell), not the browser engine.
Is text/x-url compatible with macOS or Linux?
Not natively as a functional shortcut. macOS uses .webloc files for web links, and Linux desktop environments have .desktop files. However, because text/x-url files are plain text, they can be opened in any text editor on these systems to extract the URL manually.
Are there security risks associated with text/x-url files?
Yes, like any link, they can be used for phishing or directing users to malicious websites. Because the destination URL is hidden until the file is opened or inspected, users should exercise caution when downloading .url files from untrusted sources.
General FAQ
What is a MIME type?
A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.
MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.
MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.
How do I find the MIME type for a file?
You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.
Why are multiple MIME types listed for one extension?
Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.