1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

.htaccess rewrite rule based on string

Discussion in 'Apache' started by Chomps, Aug 29, 2017.

  1. #1
    I have looked through many of the posts here and cant find something that matches my issue.
    I am using a .htaccess file with many rules in it that all work fine. I need to add one more as our CMS has changed its url. I would like any request from https://my.domain.com/?imaid=gumbie to be directed to https://my.domain.com/index.php?imaid=gumbie
    Note I just want the index.php added in. This seems fairly simple but for some bizarre reason it wont redirect. I tried this but still not working.
    RedirectMatch 301 ^?imaid=gumbie https://my.domain.com/index.php?imaid=gumbie
    Please any help would be awesome. Thank you in advance.
    Chomps, Aug 29, 2017 IP
  2. Chomps

    Chomps Peon

    Likes Received:
    Best Answers:
    Trophy Points:
    For those that would like to know, I found a solution that works as follows:

    RewriteCond %{QUERY_STRING} imaid=gumbie
    RewriteRule (.*) /index.php?imaid=gumbie [R=301,L]

    Chomps, Aug 29, 2017 IP