Here is the form:
<form action='<?php echo $_SERVER['PHP_SELF'];?>'> <p><label>Movie Title:</label><input type='text' name='search'></p> <p><input id="submit" type='submit' value='Submit'></p> </form>
When the form is submitted, the URL is currently returned like this:
localhost/movie/index.php?search=ted
I would like the url to return like this:
localhost/movie/search/ted
EDIT:
Now I have the following code in my .htaccess:
RewriteCond %{QUERY_STRING} ^search=(.*)$ [NC] RewriteRule ^$ /search/%1 [NC,R,L] RewriteRule ^search/(.+)$ index.php?search=$1 [NC,L]
This works when you enter the URL /movie/search/ted , but when you submit the form, it still appears as /movie/index.php?search=ted
php .htaccess mod-rewrite
Craigcoles
source share