I want to show the URL
http://some.com/designit/portfolio.php?cat=website&subcat=nature
as
http://some.com/designit/portfolio/website/nature.
cat and subcat in the URLs may be present, but not always.
I have put this .htaccess file in designit folder:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]
RewriteRule ^portfolio/?$ portfolio.php[NC,QSA]
RewriteRule ^portfolio/([a-zA-Z0-9_-]+)/?$ portfolio.php?cat=$1[L,NC,QSA]
Now, It is showing
..some.com/designit/portfolio.php
as
..some.com/designit/portfolio
but it is not showing
..some.com/designit/portfolio.php?cat=website
as
..some.com/designit/portfolio/website
I get "Internal Server Error.The server encountered an internal error or misconfiguration and was unable to complete your request."
What do I need to do to fix this?
RewriteRule ^portfolio/?$ portfolio.php[NC,QSA]? If I do understand what you've done, it's already modified by the previousRewriteRule(note that the?at the end of and URL is considered as the Query string and is not considerered a part of the URL (checkout how the QSA directive works to understand it here: httpd.apache.org/docs/current/mod/mod_rewrite.html)) – Olivier Pons Nov 14 '11 at 9:24RewriteRules mean: "if it's not a directory, and not a file, then whatever is it, add".php"at the end then stop (L stands for "Last" in your rule[L,QSA]). So you will never apply your two last rules unless they are really files. But in your two last rules, it seems it doesn't look for URL that concern files... Thus I'm sorry, but my suggestion would be to spend more time on the rewrite rule page I've given you on my previous comment. It's not easy, I know, but it's how you design good sites! – Olivier Pons Nov 14 '11 at 9:29