I have this snippet of .htaccess coming from Apache:
RewriteCond %{REQUEST_FILENAME} index\.php
RewriteCond %{QUERY_STRING} ^id=([0-9]+)$
RewriteCond %{DOCUMENT_ROOT}/u_pages/%1.php -f
RewriteRule .* u_pages/%1.php? [L]
Using the Winginx online converter I get the following:
location / {
if ($request_filename ~ index\.php){
rewrite ^(.*)$ /u_pages/%1.php? break;
}
}
But that doesn't seem to do anything.
What I'm trying to achieve:
I have regular plain php-documents in the folder /u_pages/
-- e.g. 123.php
, 444.php
etc.
I need each of these to have URLs on the following basis:
example.com/index.php?id=123
-where the file name (123.php
) corresponds with the number after id=
in the URL
Hoping someone can lend a hand. Thanks very much in advance.