Forum Moderators: phranque

Message Too Old, No Replies

.htaccess works on windows - doesn't on linux

         

flairview

10:37 am on Jan 28, 2006 (gmt 0)

10+ Year Member



I have strange problem that i thought someone might have encountered.

The following code matches and works on .htaccess on my localhost (windows) but not on my live hosting (linux):

^/([\w/\-_]+[\w\-]+¦(?=/))

string 1: /Test123/test/test
match1: Test123/test/test

string 2: /Test123/test/test/
match1: Test123/test/test

Basicly i am trying to match everything possible unless the last character is a forward slash then don't include it in a match. Maybe my code isn't the best way to do it (i would appreciate any help with it). Still the main problem why doesn't it work on on live hosting same apache version as the localhost.

fv

jdMorgan

4:05 pm on Jan 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is probably due the the different POSIX regular expressions libraries loaded on Windows versus your server.

If you want to match "slash followed by everything except an optional trailing slash," that could be written as "^/([^/]+)/?$"

Jim

extras

4:50 pm on Jan 28, 2006 (gmt 0)

10+ Year Member



I'm not sure if \w can be used.
I think it didn't work when I tested with Apache1.3.31.

Also, there are some differences between Apache1.3 and 2.
I know (?: ...) can be used in Apache2, but not in 1.3.33, for example.

And there might be differences with win versions of Apaches.
(Native version, Cygwin, mingw, and so on...)