I am new to apache rewrite rules, and as such am having a few weird problems. I have edited by httpd.conf file, and here are the lines that I have:
RewriteEngine On
RewriteRule ^/(css|images|js|fonts|edit|uploads|vids)($|/) - [L]
RewriteRule ^/(.+)$($|/) /index.php?user=$1
RewriteRule ^/(.+)$/edit($|/) /edit/index.php?user=$1
The first rule seems to work as specified. It allows my server to access these files with no problems.
The second and third rule is probably an error syntactically but here is the problem:
If I visit domain.com/michael then some pictures which are technically supposed to be pulling from the 'uploads' folder do show up, but if I have the url as domain.com/michael they do not. The weird part is that the folder 'images' which has the logo shows up on both counts. So it is quite confusing to me why the trailing / takes the uploads images and makes them not work.
The third rule is designed so that if I go to domain.com/michael/edit it will redirect to domain.com/edit unfortunately this does not work at all. If i navigate to domain.com/edit then the editor that I have written does show up and works, but if I try and navigate as intended by different users with different sub-directories it does not work. Not only does it not work instead it actually shows the main index.php file that is shown when the second rule works.
Any help would be greatly appreciated. I am working on a website that several users will be able to edit, but they should be able to navigate freely based on their own usernames, and i was trying to stylistically achieve this by having the urls show up sort of like how Facebook does it. Facebook.com/username