skip to Main Content

I am looking for a regex option to use with htaccess.

I need to strip out a £ symbol from any url and then redirect to another domain whilst maintaining the parameter that was after the £ symbol

So

example.com/£7.50

gets redirected to

paypal.me/myid/7.50

This was the htaccess that redirects ONLY example.com/£7.50

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.exmaple.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/[A-F0-9] 
{32}.txt(?: Comodo DCV)?$
RewriteRule ^£7.50$ "https://paypal.me/myid/7.50" [R=301,L]

I have tried some of the options in
https://gist.github.com/ScottPhillips/1721489
with no joy. Any ideas?

So anything with a £ symbol in the URL, needs the £ removing and redirecting to Paypal.me with my id and numeric value appended.

3

Answers


  1. Chosen as BEST ANSWER

    This was the working code in the end

    RewriteRule ^£/?(.*)$ "https://paypal.me/myid/$1" [R=301,L]
    

  2. RewriteRule ^£(.*)$ {NEW DOMAIN ADDR}/$1 [R=302, NC]
    
    Login or Signup to reply.
  3. You can use:

    RewriteRule ^£(.+)$ https://paypal.me/myid/$1 [R=301,L]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search