I have the following htaccess file:
RewriteEngine On
RewriteRule ^([^/]*)$ /bio.php?bio=$1 [L]
I need it to do the following:
- Get the following rewritten URL: http://www.website.com/john-smith to go to /bio.php?bio=john-smith (that kind of works at the moment)
- If there is already a folder (eg /about-us/) then show the file in that instead. At the moment it does but it adds ?bio=about-us on the end.
- Ideally if possible work with & without the trailing slash.
Any help much appreciated.
Thanks
Try something like this:
First line will skip the RewriteRule if it finds a matching physical file; second line will skip it if it finds a matching directory. The third line is the rewrite rule that will be executed if the preceding condtions are met.