I am using .htaccess file for URL re-writing and i change the some url like this using .htaccess file :-
RewriteRule ^home/?$ index.php [NC,L]
but i have no idea how i change this url
/localhost/mywebiste/complete_listing.php?category=Education&city=delhi
into this URL
/localhost/mywebiste/education-in-delhi
Every category and city in url.
i try this :
Rewrite-rule ^Agriculture-in-jaipur([A-Za-z0-9-]+)?$ complete_listing.php?category=education&&city=delhi [NC,L]
but by this i change only one type URL every time category and city will be changed
If I'm right you want to get /localhost/mywebiste/ education -in- delhi - the url with 2 variables
RewriteRule ^([A-Za-z0-9-]+)-in-([A-Za-z0-9-]+)$ complete_listing.php?category=$1&city=$2 [NC,L]
Note the L
on the end - this will be the Last rule applied.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)-in-(.*)$ complete_listing.php?category=$1&city=$2 [NC,L]
That code will return http://www.example.com/Education-in-delhi.html
RewriteEngine On
RewriteRule ^([^-]*)-in-([^-]*)\.html$ /mywebiste/complete_listing.php?category=$1&city=$2 [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.