How to rewrite dynamic URL?

Apache mod rewrite url with query string?

  • Hi do you know how to mod rewrite (in htaccess) a set of urls with query string to another domain? I want to mass redirect to one page, loosing the parameters. eg. www.example.com/page_x?reason=8 eg. www.example.com/page_x?reason=28 eg. www.example.com/page_x?reason=255 eg. www.example.com/page_x?reason=2557 all to eg. www.yahoo.com/donuts

  • Answer:

    Options FollowSymLinks RewriteEngine On RewriteBase /path_to_page # (if needed) RewriteRule ^page_x$ http://www.yahoo.com/donuts? The trailing '?' is key. If the administrator doesn't permit Option FollowSymLinks, it will not work.

jason at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.