I'm trying to make this rewriterule via htaccess file in wordpress I have the following url: https://domain_name.com/index.php/field/value_to_be_written and I want it to be internally redirect to: https://domain_name.com/index.php/field/?get_value=value_to_be_written
I have this following code but it's giving me error 500:
RewriteRule ^index.php/field/(.*)$ index.php/field/?get_value=$1 [L]
Any help would be great. Thanks in advance.
You just need leading slashes:
RewriteRule ^/index\.php/field/(.*)$ /index.php/field/?get_value=$1 [L]
Excerpt from https://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule
<!-- language: lang-none -->
+-----------------------------+------------------------+
| Given Rule | Resulting Substitution |
+-----------------------------+------------------------+
| ^/somepath(.*) otherpath$1 | invalid, not supported |
| ^/somepath(.*) /otherpath$1 | /otherpath/pathinfo |
+-----------------------------+------------------------+