Forum Moderators: phranque
Are you wanting an external "redirect" or an internal "rewrite"?Or possibly even both, if you picture an old URL structure with a query string, being redirected to a new prettier URL without the query--but the content is still getting served from the version with the query via an internal rewrite.
It is not appropriate to expect other members to write your code for you or to debug your entire project; Please don't expect other members to solve a problem you don't want to begin solving yourself.
"Fix my code" and "Do my homework for me" threads:
This is a discussion forum, not a help desk or a free code-writing service; If you have a problem, please try to research it and then phrase your post in a manner conducive to general discussion of the issue. Rather than providing one-off solutions, we prefer to help people find resources to help themselves.
A general guideline for code-related problems is: Post your own code and describe what you hoped it would accomplish. Then describe how it fails and include all relevant information from your server error logs.
...
Further its an internal rewrite in this case.It can’t be both. Either it’s an internal rewrite:
The URL to which it should redirect to
I have managed to work it out by adding a RewriteCond.Make sure it has to be a RewriteCond, and can't be embodied in the RewriteRule itself. If it involves looking at the query--like your "components-page" vs. "release-page"--then yes, it has to be a condition. But anything involving the URLpath--like "blahblah/ABC" vs. "blahblah/ABC/more-stuff-here" can and should go in the body of the rule.
RewriteCond %{QUERY_STRING} ^selectedItem=release-pageDoes the "selectedItem" parameter always come first in the query string? If you can be certain it does, then the ^ is appropriate because it lets the server get out of there all the faster. But if it can also occur non-initially, you should replace the ^ with a \b (word boundary anchor, which would match either ^ or & ).