Ad
Create SEO Friendly URLs From _GET Query
I have a search form using GET request. When I hit enter, the url is as usual not SEO friendly, is there a way in which I can make it display SEO friendly urls when entered?
Eg.
GET Request http://someurl.com?a=search&query=what+are+you+looking+for
SEO URL should be http://someurl.com/search/what+are+you+looking+for
I already created a rule
RewriteRule ^search/(\w+) index.php?a=search&query=$1
in my .htaccess that works when I manually type the SEO Url into the address bar. So I guess it's only a matter of making sure when I hit enter inside the search field, it loads the SEO Url instead of the other.
Ad
Answer
You have to redirect your orignal uri to the new uri , add the followng before your existing rule :
RewriteEngine on
RewriteCond %{THE_REQUEST} /(?:index\.php)?\?a=search&query=(.+)\sHTTP [NC]
RewriteRule ^ /search/%1? [NE,L,R]
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad