Apache rewriting without mod_rewrite?

后端 未结 1 1999
时光说笑
时光说笑 2021-01-13 16:03

How can Apache be rewriting URLs without mod_rewrite enabled or configured?

I\'m working on a site redesign from my development server. I was using a directory stru

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-13 16:32

    What you call a rewrite can be done by a lot of others instructions:

    • Redirect & RedirectMatch : for external redirection (with 301,302 or even 403 or 404 codes
    • Alias & AliasMatch : for internal redirection (internal directory re-mapping for example)
    • FallBackresource : to redirect every missing file to an index.php boostrap
    • Option Multiviews : from mod-autoindex which is enabled by default on a lot of installations

    Theses configuration things are usually not in .htaccess files by default, as .htaccess files is just a bad thing slowing down apache and allowing user to add some other rules than the one defined in VirtualHosts. Most usefull configuration stuff is in /etc/apache2/sites-enabled, /etc/apaches2/mod-enableds/ and /etc/apache2/conf.d/.

    Now the strangest one is Option Multiviews make a grep -R MultiViews /etc/apache2/*. This option will map any call to http://www.example.com/foo/bar to foo/bar.php or foo/bar.html if theses directories exists in the DocumentRoot and if theses files exists (trying on all available extensions).

    0 讨论(0)
提交回复
热议问题