I would like to know how to create a vanity url for a website.
Ideally I would like to be able to put this on a flyer:
www.charity.org.uk/monthlydonation
and when that is entered, it will go off to:
www.charity.org.uk/donate/monthly-donation.php
I've been reading about vanity urls, redirects and rewrites but quite frankly I'm not even sure what I need to do this?
I tried the following in a .htaccess file:
RewriteEngine On
RewriteBase /
RedirectMatch 301 /monthlydonation /donate/monthly-donation.php
but got an error message saying there was a redirect loop.
All time and help is greatly appreciated.
Try using mod_rewrite instead,
RedirectMatchis part of mod_alias and processes the request separate from mod_rewrite:Additionally, the reason why you're getting a redirect loop is that
RedirectMatchexpects a regex and not just a path. So/monthlydonationis the matching pattern, and that happens to also match the redirect's target: "/donate /monthly-donation.php".