I
I
Inlarion2018-09-18 21:37:35
Apache HTTP Server
Inlarion, 2018-09-18 21:37:35

Apache2 htaccess. How to redirect from an unknown path to a specific file?

Given: Apache2, rewrite enabled.
Requests like this fall on the server from a certain device:
IP/cat1/cat2/515
IP/cat1/cat2/117
IP/cat1/cat2/935
IP/cat1/cat2/..... etc.
How to wrap all requests for the /name.php file imperceptibly for this device using htaccess and possibly pass path endings to it, i.e. 515, 117, 935, etc.
I still don't understand the regular expressions for RewriteRule
I tried it like this:
RewriteEngine On
RewriteBase /
RewriteRule ^/cat1/cat2/(.*)$ /name.php [L]
For the test, I knock through the browser; IP/cat1/cat2/7171
Getting 404 with this path in query string: IP/name.php7171

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question