PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : apache2 mod_rewrite



divissimo
07.09.07, 16:16
hi i've got following code


<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /testTypo/

RewriteCond %{REQUEST_URI} !index\.php$ [NC]
#RewriteCond %{REQUEST_URI} !$ [NC]
RewriteCond %{QUERY_STRING} !.+$ [NC]

RewriteRule ^(.*)$ index.php?id=29&sA=detail&pool=$1 [R]
</IfModule>

this works fine, there's only one problem. if the REQUEST_URI is empty the rewrite SHOULDN'T be executed. i've been trying to do that with the 2. condition.

can someone help?

marce
07.09.07, 17:04
May be you could it try this way:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /testTypo/

RewriteCond %{REQUEST_URI} !$ [NC]
RewriteRule ^(.*)$ $1 [R]

RewriteCond %{REQUEST_URI} !index\.php$ [NC]
RewriteCond %{QUERY_STRING} !.+$ [NC]
RewriteRule ^(.*)$ index.php?id=29&sA=detail&pool=$1 [R]
</IfModule>


... this is not tested - but if you compare it with the last example in http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritecond - the scheme is like cond -> rule, cond2 -> rule2, ...

You have the cond. "is empty" -> rule "do nothing", cond "not empty" -> rule "do something"...

hope, that helps...


btw: Why this posting in English?

divissimo
12.09.07, 14:04
nein funktioniert leider nicht, gleich wie vorher.

403
12.09.07, 18:53
RewriteCond %{REQUEST_URI} !^$ [NC]

Wie waere es damit? (ungetestet)