Forum Moderators: phranque

Message Too Old, No Replies

Works locally but 500 Error on remote machine - RewriteRule

         

nav_it

5:34 am on Jan 10, 2007 (gmt 0)

10+ Year Member



Greetings,

I'm relatively new to modifying .htaccess files. What I'm trying to do is use RewriteRule to clean up the URLs from query strings. Here's part of what I have:

RewriteEngine on

RewriteRule ^([_0-9a-z-\.]+)$ /$1/ [NC,R]
RewriteRule ^([_0-9a-z-\.]+)/$ index.php?v1=$1
RewriteRule ^([_0-9a-z-\.]+)/([_0-9a-z-\.]+)/$ index.php?$1=$2 [NC]
RewriteRule ^([_0-9a-z-\.]+)/([_0-9a-z-\.]+)/([_0-9a-z-\.\@]+)/$ index.php?v1=$1\&v2=$2\&v3=$3 [NC]
RewriteRule ^([_0-9a-z-\.]+)/([_0-9a-z-\.]+)/([_0-9a-z-\.\@]+)/([_0-9a-z-\.\@]+)/$ index.php?v1=$1\&v2=$2\&v3=$3\&v4=$4 [NC]

I also have the following conditions before each rule (leaving them all in would have been redundant for this purpose):
RewriteCond %{SCRIPT_FILENAME}!-f
RewriteCond %{SCRIPT_FILENAME}!-d

Now, this works on my local machine, Windows+Apache 2.0.55, but not on my hosting account, Linux+Apache 1.3.37. I get a "500 Internal Server Error". Does anyone see a problem with any of the above code?

Oh, and so you know, I'm escaping the '.' and '@' in the last couple of rules for a reason: I'm passing email addresses for those variables.

Any and all help/input is greatly appreciated.

phranque

6:04 am on Jan 10, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



just a stab in the dark here.
i noticed you don't have A-Z in the regexp - is there any chance there are upper case characters involved in the hosting machine urls?

nav_it

6:04 am on Jan 10, 2007 (gmt 0)

10+ Year Member



A bit of tinkering, and it works... My apologies for the waste of database space and time of those who took out time to read the post. In case anyone is having the same problem, the solution was to escape the '.' at the beginning of the set and to not escape the '@'.

Good eye, phranque, but the [NC] specifies that it is case-insensitive. Thanks for the effort.

phranque

11:58 am on Jan 10, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



right - didn't notice the NC