views:

98

answers:

2

I call my site this way locally:

http://localhost:80/mysite/de/layer1/layer2/module

In .htaccess I have:

RewriteEngine on

RewriteRule !^((css|js|images)/.*)$ index.php%{REQUEST_URI} [L, NE]

I try to rewrite that into:

http://localhost:80/mysite/index.php/de/layer1/layer2/module

Any idea what's wrong there?

EDIT: If I write only this, then there is no error:

RewriteRule !^((css|js|images)/.*)$ index.php

But I think I need this %{REQUEST_URI} thing!!

My configuration: Mac OS X 10.6 Snow Leopard, MAMP with Apache, MySQL and PHP 5. In detail:

Apache 2.0.63
MySQL 5.1.37
PHP 4.4.9 & 5.2.10
APC 3.0.19 & APC 3.1.2
eAccelerator 0.9.5.3
XCache 1.2.2
phpMyAdmin 2.11.9.5 & phpMyAdmin 3.2.0.1
Zend Optimizer 3.3.3
SQLiteManager 1.2.0
Freetype 2.3.9
t1lib 5.1.2
curl 7.19.5
jpeg 7
libpng-1.2.38
gd 2.0.34
libxml 2.7.3
libxslt 1.1.24
gettext 0.17
libidn 1.15
iconv 1.13
mcrypt 2.5.8
YAZ 3.0.47 & PHP/YAZ 1.0.14
+1  A: 

This is the rewrite used by Drupal to accomplish a similar task:

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
kiamlaluno
+1  A: 

Im not quite sure of what you want but here a rewrite rule who will pass to index.php everything that is not index.php (to avoid an infinity loop) , /js/, /images/ and /css/.

RewriteCond %{REQUEST_URI} !^/(index.php|css|images|js)/.*$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/index.php/$1 [L]

For your server error it can be the NE flag who is available for Apache version >= 1.3.20

Patrick
I removed the ^ in !^/(index.php|css|images|js)/.*$ which caused an infinite loop. from the apache error log: "mod_rewrite: maximum number of internal redirects reached. Assuming configuration error.". I must add that my site gets called at localhost:80/mysite/ so mysite is actually the root, not localhost:80. bad thing. i know. gotta set up a local host name for this.
openfrog