Need help with rewriting URLs in Wordpress

I am working with a modified Wordpress URL that looks like this:
http://test3.ober.com/detail-page/?refid=ahla-clinical-research-practice-guide

I want to change the URLs to look like this:
http://test3.ober.com/detail-page/ahla-clinical-research-practice-guide

What Rewrite Rule should I add to the .htaccess file?



RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\\.php)$ $1 [L]
RewriteRule . index.php [L]

Thanks!

One other thing, is that the URL will always have detail-page in the URL.

I imagine something like this should work, though I haven’t tested it.

RewriteCond %{QUERY_STRING} (?:^|&)refid=([^&]+)(?:$|&)
RewriteRule ^detail-page/$ detail-page/%1?

Jeff, Thanks for the response, however it doesn’t seem to work. I suspect I might be placing your rules in the wrong location in the htaccess file? I get an internal server error with the below rules.

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]


# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]


RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{QUERY_STRING} (?:^|&)refid=([^&]+)(?:$|&)
RewriteRule ^ detail-page/$ detail-page/%1? [L]
RewriteRule ^ - [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\\.php)$ $1 [L]
RewriteRule . index.php [L]

Yeah, you put it right between another rewrite rule and its conditions. Try instead putting these new lines just after the “add trailing slash” rule. Also, be careful not to inadvertantly insert spaces. There seems to be a stray space after the “^” character.