Bryan Wong
Bryan Wong

Reputation: 633

How to do External Redirection With Parameters

How do I do an external redirection and get the 'URL-String' after .aspx?

http://www.sample.com/folder1/filename.aspx/title

to

http://www.sample.com/folder1/filename/title

I have done the following

#RewriteCond %{THE_REQUEST} ^[A-Z0-9]{3,}\s([^.]+)\.aspx
#RewriteRule ^ %1 [R=301,NE,NC,L]

But it returns wrong URL

http://www.sample.com/folder1

Appreciate your kind advice. Thank you!

Upvotes: 1

Views: 131

Answers (1)

anubhava
anubhava

Reputation: 785098

You can use this rule:

RewriteCond %{THE_REQUEST} \s([^.]+)\.aspx(\S*)
RewriteRule ^ %1%2 [R=301,NE,L]

RewriteRule ^([^.]+?)/([^/.]+)/?$ /$1.aspx/$2 [L]

Upvotes: 1

Related Questions