Question

I have recently migrated a asp.net website to php. I want to redirect the old URLs to the new URLs. I need help in redirecting the following:

ex1: /journals.aspx?href=issue&jid=1&id=16 to /jor/issue/16 (if href=issue then jid 1 is always jor in the new website and id parameter 16 is the issue)

ex2: /journals.aspx?id=118&jid=1&href=abstract to /jor/Article/118 (if href=abstract then it will redirect to article with article id that equals id).

Again, jid=1 is always jor.

Thanks!

Was it helpful?

Solution

These rules should do it

RewriteEngine on

# Match issue
RewriteCond %{QUERY_STRING} href=issue 
RewriteCond %{QUERY_STRING} jid=1
RewriteCond %{QUERY_STRING} (^|&)id=([0-9]+)
RewriteRule journals.aspx /jor/issue/%2? [R]

# Match abstract
RewriteCond %{QUERY_STRING} href=abstract 
RewriteCond %{QUERY_STRING} jid=1
RewriteCond %{QUERY_STRING} (^|&)id=([0-9]+)
RewriteRule journals.aspx /jor/Article/%2? [R]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top