Here you’ve begun the character range definition by escaping the dot character (which is NOT required in a character range definition) then by escaping a ?. Unfortunately (and the reason it’s not working for you), the ? is a reserved character (http://www.ietf.org/rfc/rfc2396.txt) which cannot be within a {REQUEST_URI} string (you may be able to encode it but I’d have to check the link above to verify that) because it’s the demarcation character defining the end of the {REQUEST_URI} string and the start of the {QUERY_STRING}. Of course, if you need to access the query string in mod_rewrite, you must do so with a RewriteCond statement.
So, other than not understanding the allowed content of URIs, I’d say that you’ve done very well.
Jeff simply didn’t read the character definition in your code correctly. Saying that, I’m sure that he does know that RewriteRules cannot examine the query string AND that the question mark is a reserved character (which should only be in a URL to separate the URI from the query string).
It makes no matter whether you want to match the P or p so long as you are consistent. If you want to match both, use
RewriteRule ^P|prensa$ /prensa.php?seo=prensa [L]
With the OR bar between the P and p, the regex will match both Prensa and prensa (if the only content of the URI string).
Actually I read the character definition just fine. Matching on non-question mark characters isn’t causing any issues. It may be unnecessary, but it’s not problematic.
Furthermore, the OP’s issue isn’t related to the forth rewrite rule, but the first. As the OP described, prensa is supposed to rewrite to /prensa.php?seo=prensa, but instead it’s rewriting to just /prensa.php. I reiterate that I don’t see anything in this htaccess that explains this behavior, nor do I see anything that explains why using a capital “P” in the URL would make it work. And so I still believe that there must be more to this htaccess than what we’ve seen.
Don’t work, when I try to access, return and error 500 internal server error. I use phpinfo() to know if the module mod_expires.c and I think that yes Thanks.
I dont know why but the error appears when I write anything in the if sentence
[standard rant #4][indent]The definition of an idiot is someone who repeatedly does the same thing expecting a different result. Asking Apache to confirm the existence of ANY module with an <IfModule> … </IfModule> wrapper is the same thing in the webmaster world. DON’T BE AN IDIOT! If you don’t know whether a module is enabled, run the test ONCE then REMOVE the wrapper as it is EXTREMELY wasteful of Apache’s resources (and should NEVER be allowed on a shared server).[/indent][/standard rant #4]
Okay, that’s NOT to call you an idiot, it’s simply to remind you in the clearest terms possible that any webmaster would only run ONE server test, not repeat server tests multiple times for EVERY request!
You also need to learn which characters are considered metacharacters with a character range definition as it seems that you’ve gone “escape crazy” by escaping every character (none of which needs escaped except the ? which should not be there in the first place).
You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.
Unfortunately anyone who learns from this tutorial will have to unlearn some incorrect information later on. I strongly recommend that anyone who’s interested in this topic go straight to the definitive source for the most complete, authoritative, and correct information.
Sorry, I’d have to give the same advice to others about your insistence on using (.*) inappropriately (among other things you’ve come up with).
As for going straight to Apache.org, I agree. However, their documentation is too “geeky” for most so my tutorial was written to make life easier for SitePoint members … and has received high praise from everyone (other than you - your comment is the first of its nature in the 5+ years it’s been online).
Members,
Take all advice here with a grain of salt, i.e., consider the source.
Good catch! MultiViews is one of those hidden traps that people can find themselves buried in and I agree that there is no logical reason to ever have it enabled.