0

I would like me site to load php files even if I dont add the .php Example:

domain.com/test

Will load domain.com/test.php I did it with:

RewriteRule ^(.*)$ $1.php

Now I want url with ONLY numbers to be redirected to homepage with the number storing in $_GET['sponsor'] I did it with:

RewriteRule ([0-9]+) index.php?sponsor=$1

So Example: domain.com/888 Will load domain.com/index.php and $_GET['sponsor']=888

The problem is that any url with number give me and error, For example domain.com/vendor/fontawesome-free/webfonts/fa-solid-900.woff

How can I change the htaccess so ONLY numbers will be redirected, any other real file with number in his filename will keep loading as is ?

Asi
  • 365
  • 3
  • 13
  • What's the difference between `^(.*)$` and just `([0-9]+)` as placeholder? – mario Jul 28 '19 at 15:36
  • @mario I didn't understand what you mean. ([0-9]+) is just for numbers. – Asi Jul 28 '19 at 15:38
  • But didn't you notice the meta characters around the parens? – mario Jul 28 '19 at 15:40
  • I wouldn't spend your time ifI saw what is wrong. Can you help and show? – Asi Jul 28 '19 at 15:43
  • See the second duplicate link for the exact pattern. Or the third reference for a more in-depth introduction on how rewriterules and patterns work. – mario Jul 28 '19 at 15:45

0 Answers0