Search code examples
mod-rewriterssurl-rewritingfeed

url-rewriting and rss feed (feedburner) issue


I am using below rule to read the URL like

URL: http://www.example.com/blog/sampe-post-title/10004/

RULE:

RewriteRule (.*)/(.*)/([0-9]+)/$ $1/details.asp?mod_id=$3 [NS,I]

Everything was fine untill I discovered that links coming via feedburner are not working anymore. Because feedburner adds some extra parameter to URL for stats/tracking etc.

For example www.example.com/blog/sampe-post-title/10004/?utm_source=feedburner&utm_medium=email&utm_campaign=Feed:+somesite+(my+feed)

My rewrite URL doesn't recognizes the above URL anymore. Any idea how to deal with it?


Solution

  • Try adding a rule for the feedburner URLs:

    RewriteRule (.*)/(.*)/([0-9]+)/\?(.*)$ $1/details.asp?mod_id=$3&$4 [NS,I]
    

    I added an extra RegEx group at the end to capture everything after the question mark and place it after mod_id. You could probably combine this with your other URL if you only wanted to have one rule for some reason, but you might as well just have two.