I have successfully created my mod_rewrite rule to change all dynamic URLs on the top level of the site, but now i need to create a rule for a second level, and i think later down the line i might need a second, second level of rewrites.
At the moment i have this
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.+)$ index.php?subj=$1
And this helps to change /index.php?subj=home to /home as it does for all other pages such as /contact /about /events and so on.
But now I have created sub pages under events and therefore need to change /events.php?event=event-name to events/event-name. But when i add another rule it messes up the whole site. What i tried to do is this
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.+)$ index.php?subj=$1
RewriteRule ^events/(.+)$ event.php?event=$1
I've even tried it with [L] flags after the Rewrite rules, but nothing seems to work, I would really appreciate it if someone can show me the best way to do this as nothing seems to work.
Many thanks in advance