Question

J'ai un fichier .htaccess qui fait en sorte que toutes les demandes passent par index.php. Maintenant, je voudrais faire une exception pour rss.php. aller directement à travers rss.php. Comment je fais ça?

Voici à quoi cela ressemble maintenant:

RewriteEngine on
RewriteBase /
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php

Merci.

Était-ce utile?

La solution

Placez ceci avant la dernière ligne.

RewriteCond %{REQUEST_URI} !^/rss\.php$

Autres conseils

Vous pouvez exclure tout fichier existant avec un autre code> RewriteCond directive :

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Vous pouvez également effectuer une réécriture correspondant au fichier, puis ignorer le reste des tests de réécriture.

En mettant la ligne suivante avant que votre RewriteRule existant soit redirigé sans passer par index.php.

RewriteRule  ^/rss.php  /rss.php  [L]

Je suis tombé sur cette page en cherchant un moyen de faire cela avec mon fichier /robots.txt.

mod_rewrite avec apache1.3

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top