How can all URLs that are plural and followed by /<integer>
be redirected to the singular name along with the integer as a parameter. See below for examples. Ideally "users" need not be hardcoded, and "vendors" would redirect to "vendor" the same way. Note that I am not using any server code (i.e. PHP, etc).
users.html (not that this page is plural)
<a href="/users/1">John Doe</a> <!-- should redirect to user.html?id=1 -->
<a href="/users/2">Jan Doe</a> <!-- should redirect to user.html?id=2 -->
<a href="/users/3">Baby Doe</a> <!-- should redirect to user.html?id=3 -->
Current configuration is as follows.
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName admin.facdocs.example.net
DocumentRoot /var/www/facdocs/frontends/admin/public
<Directory "/var/www/facdocs/frontends/admin/public">
#Options Indexes FollowSymLinks MultiViews
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
RewriteEngine On
LogLevel info rewrite:trace3
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z]+)s/(\d+)/?$ $1.html?id=$2 [L]
RewriteBase /
RewriteCond %{REQUEST_URI} !^.*\.html$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ %{REQUEST_FILENAME}.html
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/api.example.net/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/api.example.net/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/api.example.net/chain.pem
</VirtualHost>
</IfModule>