2

I have a directory with a lot of php files. But now I'm not using them anymore, so I want to redirect to my new url.

When the file exist I'm doing this:

RewriteRule client/z_([^/]*) redirect.php [L]

But how can I redirect when there's no file?
ie:
the file client/z_123.php exists and it works.
but the file client/z_321 doesn't exist, and I want to show the redirect.php with the same this link.

My question is: How can I make this working when the files doesn't exist?

BrunoRamalho
  • 1,726
  • 3
  • 17
  • 31

1 Answers1

1

Use the ? regex symbol.

RewriteRule client/(_([&/]*))? redirect.php [L]
SOFe
  • 7,867
  • 4
  • 33
  • 61