I'm trying to rewrite a URL after submitting a form using the GET method in Laravel. My .htaccess file looks like this:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteRule ^/items/search/(.*)$ /items/search?m_id=%1 [QSA, L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Having submitted the form the URL still looks like this:
http://127.0.0.1:8000/items/search?m_id=357
Any help with this would be appreciated.
Thanks.
I only just got back round looking into this. In the end I used javascript's onsubmit function to rewrite the URL
onsubmit="window.location.href=this.action + '/' + encodeURIComponent(this.elements['m_id'].value); return false;"