Dr M L M J
Dr M L M J

Reputation: 2397

.htaccess code to redirect dynamic links to new dynamic links

I have redesigned my site

Previous link sample is:

mydomain.com?index.php?mo=blog&srno=62#

New link will be:

mydomain.com?blog-post.php?srno=62

Here srno can be any digit from 1 to 62 .

How can I redirect user coming with previous link to new link with .htaccess ??

Upvotes: 1

Views: 27

Answers (1)

anubhava
anubhava

Reputation: 785098

You can use this rule in your site root .htaccess:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+index\.php\?mo=blog&(srno=\d+) [NC]
RewriteRule ^ /blog-post.php?%1 [L,R=301]

Upvotes: 1

Related Questions