problem with mod_rewrite
Good evening all,
I have a website which has a main navigation with some links being a sub level navigation. All my content files are in one folder called 'content'.
My menu is layed out as such:
Now, when one of the sub level menu links are visited, rather than the url saying: www.mysite.com/home or www.mysite.com/contact, it needs to read as follows: www.mysite.com/about/who-we-are.
I have rewritten the URL using .htaccess and can get it to work - only with the top-level menu links. When I try adding the 'About' to the URL string, it either sends me to a page which tells me there is a redirect loop or a 404 error.
Here is my .htaccess:
As stated before, with only 1 $_GET value being passed (the filename), it works perfect, pages load etc. When I try passing the 2 $_GET values ('directory' and filename) - that's when I receive the redirect loop page or 404.
RewriteRule ^/?([a-zA-Z-]+)$ index.php?page=$1 [L,QSA]
RewriteRule ^([a-zA-Z-]+)/([a-zA-Z-]+)/?$ index.php?category=$2&page=$1 [L]
I am passing the values through the <a> tag as follows: <a href="./PropertyOwner/who-we-are">Who We Are</a>
I've changed the values around in my second RewriteRule as I want the filename part to be at the very end, but to no avail.
Can anyone help me fix this problem?
Can anyone see what I'm doing wrong?
I thought it may be the QSA flag on the first Rule as that seems to append a string whereas I don't want to append to the end of the string, but insert it before the filename part.
Thanks very much for your time.
Sorry for the post, I've figured it out and got it working.