I have tried a lot, but no luck. My requirements are below.
Need to rename URL from one to another
ex:
/checkout/idnumber/checkout_direct
to/booking/idnumber/
Note: id number is automatically generated
Need to get same ID number in renaming url too (id number will vary)
Please help me to solve this issue. Thanks in Advance.
You cold use in your .htaccess file the following code (note that this isn't a working code, because if you have the URL
"/checkout/idnumber/checkout_direct"
it means that you already have 'clean urls', and for this, you have a .htaccess rewrite rules, for example to clean .php and may conflict with this):If you haven't set any .htaccess rule, your urls will look like:
instead of: /
checkout/id_number/checkout
(clean URL).For that, usually is a better practice (and more easy) to set the params like:
and then:
.htaccess syntax:
Here a very good examples of how working with .htaccess: https://gist.github.com/ScottPhillips/1721489
Hope it helps to you!
UPDATE
Acording to your comment, I guess your file is 'index.php', right? This is the RewriteRule:
This will make all request from: example.com/checkout/{any_number}/checkout_direct redirects to example.com/booking/{any_number} . Or:
I'm not really sure what of 2 you want.
This is what you want in your question, but I think that you should include more RewriteRules to point out which file will 'catch' the request, i.e, once in 'example.com/booking/111' should point to:
example.com/booking/111
=>index.php?booking=111
In order to catch the request and be able to $_GET the booking number and everything. Hope it helps