Welcome! Log In Create A New Profile

Advanced

Vanity URL when file doesn't exist

Posted by thrusong 
Vanity URL when file doesn't exist
June 29, 2013 09:15AM
Hi,

In my NGINX conf, I'd like to set-up my site with vanity URLs when the file doesn't exist.

This works for the most part, but I'd like to have the vanity URL include periods, underscores, dashes, and any alphanumeric characters: rewrite ^/([a-zA-Z0-9-_]+)$ /profile.php?url=$1 last;

I'd only like to rewrite to the profile if the path doesn't exist. profile.php will throw a 404 header and error message if the user doesn't exist.

Right now, only vanity URLs with alphanumeric characters work. If I add \. to the rewrite line, then none of my pages work and vanity URLs work. example.com/katie.vw should be a vanity URL, but I guess my site thinks it's a file name.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 153
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready