How to save rewriting rules in a database?

I am developing a new site, and I would like to keep my rewrite rules in the database, and not directly in the .htaccess files.

I have another site that uses Opensef ( http://sourceforge.net/projects/opensef/ ) using Joomla! who does it, but im not even 100% how it works under the hood.

How can I store these rules in a database, query them on request and reassign them to a clean URL if it is found? Is there a better way to do this instead of loading the .htaccess file (maybe 1000 entries)?

Thanks,

+3
source share
5 answers

mod_rewrite , PHP Python, mod_rewrite.

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html (. )

RewriteMap    quux-map       prg:/path/to/map.quux.pl

+6

, Joomla, , .htaccess mod_rewrite .

, , Openserf. , , , Redirect PHP, . , , Joomla , ,

, Pathauto Drupal, .

+2

, , :

  • .
  • .htaccess, , .
  • .htaccess .

. .

+1

UrlRewriteFilter, Tomcat Apache.

Tomcat - - , Apache (, FastCGI PHP), , Apache.

0

, , , , , , script, . Apache ErrorDocument, URL- script.

You were pretty subtle in the details of what a "new site" is, but you might want to create a Front Controller for your application, and it takes care of all the incoming URLs. Many (most?) Web applications use this approach.

0
source

Source: https://habr.com/ru/post/1709551/


All Articles