1

I want to rewrite this URL:

bookingstyles/search-treatment?search_service_hidden=89&service_group_id_hidden=

to give something like this:

/bookingstyles/search-treatment/89/

I have tried using this .htaccess rule:

RewriteEngine On 
RewriteRule /([0-9]+)/([0-9]+)/$ http://localhost/bookingstyles/search-treatment.php?search_service_hidden=$1&service_group_id_hidden=$2 [L]

But I am still getting the same old URL.

Vince Bowdren
  • 8,326
  • 3
  • 31
  • 56
Addy
  • 11
  • 2
  • Hi Addy, and welcome to Stack Overflow. I have edited your question to make the URLs clearer (more readable); remember, on this site it is encouraged for other users and you to [edit] your question to improve it as much as possible. Good luck! – Vince Bowdren Dec 05 '16 at 17:48

1 Answers1

0

Have you modified the code/link in your php file?

I think there is no need to specify the entire url in Rewite rule,instead you can use {HTTP_HOST}%{REQUEST_URI}

Try this one

RewriteRule ^bookingstyles/(.+)/(.+)\.html$ search-treatment.php?id=$2&name=$1 [nc]

Setting up virtual host is a better solution.The following links may help.

https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_rewrite-for-apache-on-ubuntu-14-04

.htaccess not working on localhost with XAMPP

Community
  • 1
  • 1
user3575353
  • 397
  • 1
  • 8