Urgent help need please - .htaccess and asp urls

I am trying to redirect (301) this URL: -

/Contents/Text/Index.asp?SiteId=476&SiteExtra=19749316&TopNavId=425&NavSideId=5383

It is not working…

This is the .htaccess file content: -

DirectoryIndex index.php

RewriteEngine on

#any URL request that doesn’t have an extension will be redirected to index.php
RewriteRule !\.[a-z]{2,7}$ index.php

redirect 301 /Contents/Text/Index.asp?SiteId=476&SiteExtra=19749316&TopNavId=425&NavSideId=5383 http://olddomain/

Any help will be very gratefully received! Many thanks.

The file does have an extension, namely .asp, so your RewriteRule is out.

The ‘redirect’ directive doesn’t do query strings so that one’s out to. What you want is a combination of a RewriteCond and a RewriteRule


RewriteEngine On

RewriteCond %{QUERY_STRING} ^SiteId=476&SiteExtra=19749316&TopNavId=425&NavSideId=5383$
RewriteRule ^/?Contents/Text/Index\\.asp$ index.php [L,R=301]

Are you sure & shouldn’t be & btw?

Rémon,

It definitely should only be &!

Regards

DK