Oracle B12255-01 Manuel d'utilisateur Page 128

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 224
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 127
mod_rewrite
7-58 Oracle HTTP Server Administrator’s Guide
If there was a request for /demo1/not_just_index.html, all the preceding
rewrite rules would have redirected the request the request to
/alldemos/index.html, that may not be what you want. It is quite possible that
you may want to redirect to the corresponding files in /alldemos, as listed in
Table 7–6.
Then you have to use substitution in your rewrite rule as follows:
RewriteRule ^/demos1(.*)$ //alldemos/$1 [R NC]
The explanation for this rule is:
Take the value of the expression, such as happy.html, go.jpg, and lucky.jpg,
that appears after demo1 as variables ($1) and substitute it after /alldemos/.
Redirection Examples
For redirecting requests from the DocumentRoot to a directory called newroot, set
the following mod_rewrite directives:
RewriteEngine On
RewriteRule ^/(.*)$ /newroot/$1 [R]
For directing requested for files from one directory (olddir) to another (newdir),
set the following directives:
RewriteEngine On
RewriteRule ^/olddir(.*)$ /newdir/$1 [R]
In each of these cases, you should ensure that the requested resources are indeed
available in the redirected location. The mod_rewrite module does not ensure the
existence of the requested resource in the new location.
Table 7–6 Request Redirection
Request for Redirected to
/demo1/happy.html /alldemos/happy.html
/demo1/go.jpg /alldemos/go.jpg
/demos1/lucky.jpg /alldemos/lucky.jpg
See Also: Module mod_rewrite in the Apache Server
documentation.
Vue de la page 127
1 2 ... 123 124 125 126 127 128 129 130 131 132 133 ... 223 224

Commentaires sur ces manuels

Pas de commentaire