Title: htaccess redirect from url with querystring
Tags: .htaccess;redirect
Question: when I digit this url:

```http://www.mydomain/search.php?page=1&amp;order=ASC&amp;contract=rent&amp;new=
```

url should redirect to

```http://www.mydomain/rent/1
```

I try to add this line in my .htaccess, without success:

```Redirect http://www.mydomain/search.php?page=1&amp;order=ASC&amp;contract=rent&amp;new= http://www.mydomain/rent/1
```

thanks in advance!!!



Here is another answer: Add these lines instead (but you'll only need to add the first line if it isn't there already):

```RewriteEngine On
RewriteCond %{QUERY_STRING} ^page=(\d+)&amp;order=ASC&amp;contract=rent&amp;new=$
RewriteRule search.php /rent/%1? [L,R=301]
```


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:10/07/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<.htaccess><redirect>', 'Title': 'htaccess redirect from url with querystring', 'ViewCount': 35, 'id': 19235706, 'user_AboutMe': "<p><strong>Catholic, Apostolic, Roman.</strong>\nEnthusiastic Coder and 3D Artist with the aim of spreading the Gospel.</p>\n<p>I I love Jesus Christ and Mary!\n<strong>Thanks my Lord</strong> because <strong>you are my Creator</strong> and I'm your creature! <strong>JHS</strong></p>\n<p>Anima Christi, sanctifica me.\nCorpus Christi, salva me.\nSanguis Christi, inebria me.\nAqua lateris Christi, lava me.\nPassio Christi, conforta me.\nO bone Jesu, exaudi me.\nIntra vulnera tua absconde me.\nNe permittas me separari a Te.\nAb hoste maligno defende me.\nIn hora mortis meae voca me,\nEt jube me venire ad Te,\nUt cum Sanctis tuis laudem Te\nIn saecula saeculorum.</p>\n", 'user_AccountId': 522347.0, 'user_DisplayName': 'Vincenzo Lo Palo', 'user_Reputation': 1303.0, 'user_Views': 155.0, 'user_id': 1780601.0}}