0

I have a url like this -

http://www.xyz.in/zone/zone.php?zone_id=zone_118

I need to write rule in .htaccess such that the above url should be executed with below url :

http://www.xyz.in/zone/zone/zone_118 OR
http://www.xyz.in/zone/zone_118

Any help will be highly useful

I am trying as below but not getting any luck :

 RewriteEngine on
 RewriteCond %{QUERY_STRING} zone_id=$1
 RewriteRule ^zone/zone\.php$ /zone/?zone_id=([^\&\ ]+) [L,R=301]
 Redirect one clean URL to a new clean URL
Monty
  • 1
  • 1
  • Please do share your htaccess in your question, thank you – RavinderSingh13 May 26 '21 at 20:21
  • @RavinderSingh13 - Edited my question to include the file – Monty May 26 '21 at 20:26
  • 1
    This is a very straightforward role to write, but your attempt is basically back to front. Have a look at this: [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](https://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained) – IMSoP May 26 '21 at 20:27
  • @IMSoP Have checked the link but still facing issue. can you please write it for me ? – Monty May 26 '21 at 20:35
  • 1
    Giving you one example, that's basically identical to thousands of examples you could find online, isn't going to help you learn; next time you need a rule, you'll be back with another question, with a few words changed. If you're here to learn, you need to do more than "check the link"; you need to really try to understand it. If you're here to have other people write code to order, pay someone some money instead. – IMSoP May 26 '21 at 22:17
  • @IMSOP is right, you have your RewriteRule quite wrong, check [this very nice explanation](https://stackoverflow.com/a/20563773/145939) about how mod_rewrite works – Ant May 26 '21 at 22:44

0 Answers0