You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Miguel J. Jiménez" <Mi...@isotrol.com> on 2008/06/13 11:22:01 UTC

[users@httpd] RewriteRule help!

Hi, I am having a little problem here, I have a .htaccess that looks
thus:

RewriteEngine on
RewriteBase /INDEX
RewriteRule \.(log|sqlite)$ index.php [L]
RewriteRule \.(js|css|png|jpg|gif|xml)$  - [L]
RewriteRule ^(.*)$ index.php?m=$1 [L,QSA]

When I type "http://foo/INDEX/mp3" it goes [internally] to
"http://foo/INDEX/index.php?m=mp3". Great so far... The problem is when
I try to forbid access to "http://foo/INDEX/index.php?m=mp3" for the
user. I mean if the user types "http://foo/INDEX/index.php?m=mp3" I
want the apache to send a redirect code or something...

I tried:

RewriteCond %{IS_SUBREQ} false
RewriteRule index.php - [L,NS,R=404]

...just below  the line "RewriteBase /INDEX" but when I do this, it just
redirect *always* even if I type "http://foo/INDEX/mp3".

How can I make apache work fine with "http://foo/INDEX/mp3" and
redirect to an error page (or moved url or wahtever)
with "http://foo/INDEX/index.php?m=mp3" (from the client view)

thanks for the help

---
.---------------------------------------------------------.
| Miguel J. Jiménez                                       |
| Sector Público, ISOTROL S.A.                            |
| mjjimenez@isotrol.com                                   |
:---------------------------------------------------------:
| KeyID 0xFFE63EC6             hkp://pgp.rediris.es:11371 |
:---------------------------------------------------------:
| Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta.    |
| Parque Tecnológico Cartuja '93, 41092 Sevilla (ESP).    |
| Tlfn: +34 955 036 800 (ext.1805) - Fax: +34 955 036 849 |
| http://www.isotrol.com                                  |
:---------------------------------------------------------:
| UTM ED-50             X:765205.09 Y:4144614.91 Huso: 29 |
:---------------------------------------------------------:
|   "Me dijeron: 'instala Windows, se listo'; así que     |
| instalé primero Windows y luego fui listo y lo borré    |
| para instalar Linux"                                    |
'---------------------------------------------------------'