homepage Welcome to WebmasterWorld Guest from 54.242.200.172
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
What's wrong with this rewrite rule
It has no problem on my dev computer
iProgram




msg:3354418
 11:03 am on May 31, 2007 (gmt 0)

RewriteEngine on

...
other rewrite rule here which works
...
RewriteCond %{REQUEST_FILENAME}!-d
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule ^([a-zA-Z0-9-_\.\/]+)$ /test.php?id=$1 [L]

The last one will generate an 500 error to my server. I want to rewrite all requests with letters, number "_", "-" and "." to test.php?id=...
What's wrong with it and how to fix it?

 

jdMorgan




msg:3355231
 12:28 am on Jun 1, 2007 (gmt 0)

Escape the hyphen. No need to escape the others. Use [NC] to eliminate "a-z" and speed things up.

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Z0-9./_\-]+)$ /test.php?id=$1 [NC,L]

The difference is likely in the POSIX regex library on each machine; It's part of the OS, not the server software.

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved