How to create a Vanity URL in Static Hosting
Looking to create a Vanity URL (sometimes called Pretty URLs or Short URL)? These URLs can be used to redirect someone to another website or page on your site, using your domain name as a start.
You can use this method to create a URL that will redirect to a destination of your choosing, such as having "mydomain.com/social" redirect to one of your social media profiles. We'll outline how to do this using the Simple Editor in static hosting, but you can achieve the same result using the FTP client of your choice.
- To get started, first log in to your Porkbun account, which should take you to your Domain Management page. If you're already logged in, click on ACCOUNT in the top right corner and select "Domain Management" from the menu.
- Click on the green Static Hosting icon under the Website column on your domain.
- Click on Simple Editor to begin using our editor interface.
- Create a new directory and title it after what you want your Vanity URL to be. Note: Static Hosting is case-sensitive.
- In the new directory, create a new file and title it "index.html."
- After creating your index.html file, click "Disable Visual Editor" at the bottom of the page.
- Copy and paste the following into the editor.
<html> <head> <meta http-equiv="refresh" content="5; URL=your-destination-url" /> </head> <body> <p>If you are not redirected in five seconds, <a href="your-destination-url">click here</a>.</p> </body> </html>
- Change the two areas with "your-destination-url" to be the full URL you're trying to forward too, including the "https://" (for example: https://porkbun.com/awesome) and click save.
That's it! You now have a Vanity URL you can use to redirect visitors to another website. Note, you can also do this with a subdomain as well. Read how to create a subdomain in Static Hosting here.