I've seen and implemented rewrite urls that convert query strings to paths and vice versa. I'm still not very good at writing custom rules and I haven't seen an example where the query string's converted path is re-written as the first subdirectory of a URL.
Using htaccess rewrite rules, is this possible? www.website.com/?d=test rewrites to www.website.com/test and www.website.com/about/?d=test rewrites to www.website.com/test/about and www.website.com/about/overview/?d=test rewrites to www.website.com/test/about/overview
You can use:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^d=(.+)$ [NC]
RewriteRule ^(.+)/?$ %1/$1? [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.