URL Rewrite with parameter and php query
Give the following a try:
- Confirm that
mod_rewrite
is loaded - Check that
AllowOverride
allows htaccess parsing The following rule (inside
eventfinder
directory):RewriteEngine OnRewriteBase /eventfinder/RewriteCond %{THE_REQUEST} ^GET\ /eventfinder/index\.php\?event=([^\s&]+) [NC]RewriteRule ^index\.php$ %1 [R,L,QSD]RewriteRule ^(?!index\.php([^/]+))$ index.php?event=$1 [L]
RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^([^/]+)/?$ /eventfinder/index.php?event=$1 [L]
You can us !-f
and !-d
checks on the requested filename to ensure that the URL that's being typed is not a file and not a directory before doing the rewrite itself - it prevents a recursive loop on index.php