I have been dealing for hours with a mod_rewrite problem. I am working with a localhost under Windows. Apache 2.4 with XAMPP
I am trying to do a RewriteRule from my local htaccess with no success. This is the rule:
RewriteRule Event/(.*)$ event/this-event.php?id=$1 [L,R=301]
What I need to rewrite is: Event/4027 to event/this-event?id=4027
The thing is that I have a directory called event so the Event from the pattern is getting confused with the event directory. If I change Event from the pattern to any other word it works fine.
RewriteRule AnyWord/(.*)$ event/this-event.php?id=$1 [L,R=301] # This works!
htaccess file is located in the DOCUMENT_ROOT folder and the content is just:
RewriteEngine On
RewriteBase /
# and the RewriteRule
I have tried every tip, trick, advice I have found. I have tried several variations of the rule, using ^Event or (*.)/Event, etc. Also tried using RewriteCond to check if exists file inside directory or if exists directory. I have disabled the mod_speling module just in case the uppercase was disturbing. Also have tried using Options -Multiviews.
I couldn't get none of these to work. If someone can give me an advice I would be very grateful.
Thanks!