I have used htaccess
file for rewriting URL
Earlier my URL was
http://example.com/New-York-Mills.php?ff_nm_from=new&search=hotel&location=north park
After rewriting with htaccess
, it becomes:
http://example.com/New-York-Mills/new/hotel/north+park
But results are not displaying now. How can I get the results after rewriting url
Htaccess code:
RewriteEngine On
RewriteCond %{THE_REQUEST} \ /+New-York-Mills\.php\?ff_nm_from=([^&]+)&search=([^&\ ]+)&location=([^&\ ]+)
RewriteRule ^ /New-York-Mills/%1/%2/%3? [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^New-York-Mills/([^/]+)/([^/]+)/([^/]+)$ /New-York-Mills.php?
ff_nm_from=$1&search=$2&location=$3 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /style.css [NC]
how about it?
RewriteRule http://example.com/(.+)/(.+)/(.+)/(.+)/? http://example.com/$1.php?ff_nm_from=$2&search=$3&location=$4
hope it helps, otherwise show us your code
I have tried this rewrite rule:
RewriteRule http://example.com/(.+)/(.+)/(.+)/(.+)/? http://example.com/$1.php?ff_nm_from=$2&search=$3&location=$4
but results are not showing and htaccess file not working in any browser except Firefox. Below is my htaccess code.
RewriteCond %{THE_REQUEST} \ /+New-York-Mills.php\?ff_nm_from=([^&]+)&search=([^&\ ]+)&location=([^&\ ]+)
RewriteRule ^ /New-York-Mills/%1/%2/%3? [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^New-York-Mills/([^/]+)/([^/]+)/([^/]+)$ /New-York-Mills.php?ff_nm_from=$1&search=$2&location=$3 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /style.css [NC]