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
    Hi,
    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.
    SEMrush
     
    Chomps, Aug 29, 2017 IP
    SEMrush
  2. Chomps

    Chomps Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    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]

    Regards
     
    Chomps, Aug 29, 2017 IP