Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a tumblr style profile url

I wonder, how does tumblr doing profile url like this:

http://www.username.tumblr.com/ 
http://username.tumblr.com/

I know we can change the profile url

http://www.website.com/profile.php?user=username

to

http://www.website.com/username

using the following RewriteRule

RewriteRule ^([^/]+)/?$ profile.php?user=$1 [L,QSA,NC]

I don't know how tumblr doing those profile urls.

How can we make user profile urls like this:

http://www.username.website.com/
http://username.website.com/

I have a VirtualHost.

like image 781
Azzo Avatar asked Jan 02 '19 19:01

Azzo


People also ask

How do I put my Tumblr URL on Instagram?

From the Instagram home screen, tap your profile icon, followed by the menu icon in the top right. Select Settings > Account > Sharing to other apps. Select the account you want to link and enter your login information. You can link a number of networks, including Facebook, Twitter, and Tumblr.


1 Answers

Key solution: wildcard subdomains.

This allows you to make *.domain.com point to your server.

From your example, let's say we enabled wildcard subdomains for domain.com and we want to provide user subdomains, such as http://username.domain.com. You'd have something like this:

RewriteCond %{HTTP_HOST} ^((?!www.)[^.]+)\.domain\.com$ [NC]
RewriteRule ^(.*)$ /%1/$1 [L]

where http://username.domain.com/xxx would point to /username/xxx.

Note that this example has been reduced and simplified as much as possible for the explanation. You'd maybe need other rules, depending on your context, to handle main domain and other conditions.

like image 127
Justin Iurman Avatar answered Sep 23 '22 21:09

Justin Iurman