Hi, please help in to set rewrite rule for dynamic api.
https://abc.domain.com/v2/product_shots.php?cc=US&user_id=¤tpage=&trim_video_id=
redirect to
https://dc.domain.tv/v2/product-shots-all?cc=US&user_id=1234567¤tpage=1&trim_video_id=2602
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
To set up a rewrite rule that converts your dynamic URLs, you can make use of the RewriteRule directive in an .htaccess file or directly inside your server block configuration. Here’s a general example of how it might look for your use case:
- RewriteEngine On
- RewriteCond %{QUERY_STRING} ^cc=([^&]*)&user_id=([^&]*)¤tpage=([^&]*)&trim_video_id=([^&]*)$
- RewriteRule ^v2/product_shots\.php$ https://dc.domain.tv/v2/product-shots-all?cc=%1&user_id=%2¤tpage=%3&trim_video_id=%4 [R=301,L]
With the RewriteCond directive, we are matching the query string parameters and with RewriteRule, we’re redirecting the request to the new URL, preserving the query string values.
This is just sample code and might need adjustments according to your exact requirement.
Please make sure to replace dc.domain.tv and abc.domain.com with your domain names and change query string parameters according to your page.
Information about the mod_rewrite module and how to use it can be found in the DigitalOcean documentation:
https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_rewrite
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.