ReWriteRule ^dir/.*$ /location-where-to-go.html [L,R=301]
RedirectMatch 301 ^/sub(.*)$ http://www.website.com/page.html
RedirectPermanent /sub http://www.example.com
This would likely be a code-order problem, where the internal rewrite of the static URL to the 'weird' dynamic URL is occurring before the external redirect.
In order to control the order of execution you will need to use the mod_rewrite version of the redirect, and place the redirect ahead of the internal rewrite. Further, you'll want to clear any query string received with the client request:
RewriteRule ^sub/ /page.html? [R=301,L]
I assume that you already have other working RewriteRules. If not, you will need to 'set up' mod_rewrite by putting the following code before your first RewriteCond or RewriteRule:
The Options directive may not be allowed on your server, but if it is allowed, it may be required. There is no way to tell except to try it. If it is not allowed and also required, then you won't be able to use mod_rewrite on your server.
Users browsing this forum: No registered users and 6 guests