Forum Moderators: phranque

Message Too Old, No Replies

[mod_rewrite] problem rewriting url

         

manuelsechi

4:54 pm on Dec 14, 2005 (gmt 0)

10+ Year Member



hello all

i'm trying to rewrite an url like this:
[mysite.com...]

to something like this:
[mysite.com...]

this is my attempt but it doesn't work at all:
RewriteCond %{REQUEST_FILENAME} dir1/(.*?)/(.*?)/(.*?)$
RewriteRule ^dir1/(.*?)/(.*?)/(.*?) /dir1/$1/?start=$2&cp=$3

whats wrong?
if someone can tell me a better solution he is welcome
thanx all and excuse me for my bad english :-(

bye

jdMorgan

5:54 pm on Dec 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



manuelsechi,

Welcome to WebmasterWorld!

> whats wrong?

You are trying to use multiple instances of the ambiguous regular expressions pattern ".*" in an unanchored pattern, and this can cause problems. Try:


Options +FollowSymLinks
RewriteEngine on
RewriteRule ^dir1/([^/]+)/([0-9]+)/([0-9]+)$ /dir1/$1/?start=$2&cp=$3 [L]

You should not need to use RewriteCond at all in this case.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

manuelsechi

8:49 pm on Dec 14, 2005 (gmt 0)

10+ Year Member



thank u Jim
it work perfectly

regards
Manuel