You are confusing redirects and rewrites and you are confusing URLs with filepaths.
A redirect is an HTTP response from your server to a client request. It says "What you asked for has moved. Ask for it again using this new (provided) URL." This response terminates the current HTTP request/response transaction, and it is up to the client to invoke a new one. The client may (it is not required to) repeat its request, using the new URL provided in the server's redirect response. If it does so, it will update its address bar to reflect this new URL. A redirect is a URL-to-URL translation.
A rewrite is an operation that takes place solely within your server, and solely within the context of the current HTTP request. It simply "maps" a client-requested URL to a (non-default) server filepath. The client is totally unaware of this operation, if it is correctly implemented. A rewrite is a URL-to-server-filepath translation.
URLs are defined by HTML pages and are used "out on the Web." Filepaths are defined and used inside servers. These are not equivalent things, and in fact, need not even have any resemblance to each other. It is only the action of the server that "connects" URLs to filepaths.
Link to the friendly/pretty URL from your HTML pages.
Then internally rewrite --do not redirect-- requests for these friendly/pretty
URLs to your script
filepath.
Once that is working, add another rule that detects direct client requests for the old/unfriendly/dynamic URLs, and redirects them to the appropriate new/friendly/pretty/static URLs.
This last step will only be possible if the old URLs contain all necessary 'text' to construct the related new URLs. If this is not the case, then an alternative is to detect the old/unfriendly/dynamic URLs and rewrite them, either to a new script, or to your existing script, but with an additional name/value pair in the query string that says, "this old/unfriendly/dynamic URL request needs to be redirected." The script can then look up the new/friendly/pretty/static URL that corresponds to the client-requested URL in your database, and generate a 301-Moved Permanently redirect response.
The "direct client request" proviso is required in order to prevent an infinite rewrite/redirect loop. You must check the the dynamic URL is being requested directly by the HTTP client, and is not being requested as a result of your internal friendly-URL-to-script rewrite rule. This can be accomplished by using a RewriteCond to check the URL-path in the client request line stored in the server variable %{THE_REQUEST} to be sure it is dynamic and matches that 'seen' by the RewriteRule, or by checking the %{REDIRECT_STATUS} variable for a blank value. Several examples of both of these approaches are available in previous threads here (search for "RewriteCond" plus the variable names).
The thread entitled "
Changing Dynamic URLs to Static URLs [webmasterworld.com]" in our Apache Forum Library discusses the entire process, and may prove useful.
Also, be sure to completely-flush (that is, delete) your browser cache before testing any newly-uploaded server-side code -- including .htaccess files, scripts, etc. Otherwise, your browser may not send any new requests to your server, but instead will show you stale cached page contents and server responses.
Jim