Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite

         

firefoxin

12:19 pm on Mar 22, 2010 (gmt 0)

10+ Year Member



how can i redirect url's with this kind of format to my index page.

from:

  • http://www.domain.net/comments.php?shownews=1
  • http://www.domain.net/comments.php?shownews=2
  • http://www.domain.net/comments.php?shownews=3
    .
    .
    .
  • http://www.domain.net/comments.php?shownews=9999


    to:

  • http://www.domain.net/
  • jdMorgan

    5:12 pm on Mar 22, 2010 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    Use Apache mod_rewrite. The RewriteRule pattern must match the URL-path "comments/php" and a RewriteCond examining %{QUERY_STRING} will be needed to match the "shownews=<digits>" query appended to that URL-path. Finally, add the "?" mod_rewrite operator to the end of the replacement URL in the RewriteRule in order to clear the current query string.

    See the resources cited in our Apache Forum Charter if you need additional info.

    Jim