-1

can anyone please help me to rewrite url in php... http://localhost:81/cabnotels/Domestic-tours/tour.php?Delhi&india%27s-golden-triangle-tour&type=tour&id=19

This is the current URL and I want to rewrite as.. http://localhost:81/cabnotels/Domestic-tours/tour/Delhi/india's-golden-triangle-tour/tour/19

Please help.. Thank you in advance.

CBroe
  • 91,630
  • 14
  • 92
  • 150
pallavi-gope
  • 31
  • 1
  • 6
  • 1
    Please share the code you tried, we're here to help, not to write code for you :) Also make sure `mod_rewrite` is enabled on your installation – GlennM Sep 16 '20 at 05:03
  • And please don’t tag all over the place. This question has very little to do with `javascript` or `phpmyadmin`, and even for tagging `php` there is no real good reason here so far (tags removed.) – CBroe Sep 16 '20 at 07:56

1 Answers1

0

You can not use comma in your url like you have in (india's) and you can rewrite your url using the htaccess like:

RewriteRule ^cabnotels/domestic-tours/tours/([^/]*)/([^/]*)/tour/([^/]*)$ tour.php?$1&$2&$3&$4 [QSA,L,NC]

OR Simply if you have only one URL:

RewriteRule ^cabnotels/Domestic-tours/tour/Delhi/indias-golden-triangle-tour/tour/19$ cabnotels/Domestic-tours/tour.php?Delhi&india%27s-golden-triangle-tour&type=tour&id=19
Mubashar
  • 284
  • 2
  • 9
  • I have used this --- RewriteRule ^cabnotels/domestic-tours/tour/([^/]*)/([^/]*)/tour/([^/]*)$ tour.php?$1&$2&$3&$4 [QSA,L,NC] but it's not working, I removed the india's also and simply added india, It's a dynamic page. – pallavi-gope Sep 16 '20 at 08:03