I'm very new with mod_rewrite and I'm trying to get my own rules... I have this simple line:
RewriteRule ^concorso/(.*)/$ concorso/?iModule=13&iData=$1 [L]
It is working with URLs like: http://www.mysite.com/concorso/2/ but not with URLs like http://www.mysite.com/concorso/2 (no trailing slash)
I know that maybe this is a very common issue, but all the examples I find online are.. "oversized" for this simple rule
So, how can I automatically add a trailing slash? Please notice that a rule like:
RewriteRule ^contatti/$ contatti/?iModule=10 [L]
adds automatically a slash... And I tried also:
RewriteRule ^concorso/(.*)/?$ concorso/?iModule=13&iData=$1 [L]
(last slash optional) but I get Apache errors:
[Wed Dec 29 10:02:41 2010] [error] [client 127.0.0.1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecu开发者_JAVA百科rsion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. 127.0.0.1 - - [29/Dec/2010:10:02:41 +0100] "GET /concorso/2/ HTTP/1.1" 500 535
Thanks for your help!
Try restricting the characters that the pattern will accept to prevent your pattern from matching what you are rewriting to. For example, if you only want to match urls /concorso/###
where ### are digits:
RewriteRule ^concorso/([0-9]+)/?$ concorso/?iModule=13&iData=$1 [L]
More generally, this will work by only matching URLs without query strings:
RewriteRule ^concorso/([^?]*)/?$ concorso/?iModule=13&iData=$1 [L]
精彩评论