1

I have a URL like this:

/user/registration/?user_group_id=Buyers

I would transform it in:

/user/registration/buyers/

I tryed many ways but they didn't worked, mod rewrite is enblaed and worked for other instructions.

in my htaccess:

RewriteEngine On
RewriteBase /

#without www
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

#with www
RewriteCond %{HTTP_HOST} ^(?!www\.)(.+)
RewriteRule ^(.*) http://www.%1/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* ./index.php

RewriteRule ^user/registration/([^/]*)$ /user/registration/?user_group_id=$1 [L]

<Files *.ini>
    order deny,allow
    deny from all
</Files>

thank you

papababa
  • 11
  • 3

1 Answers1

0

Use this:

RewriteEngine On
RewriteRule ^user/registration/([^/]*)$ /user/registration/?user_group_id=$1 [L]

It will give you the path: /user/registration/buyers/

Joe
  • 4,503
  • 4
  • 28
  • 47
  • I did it as if the URL was `www.example.com/user/registration/?user_group_id=Buyers`. Is that the complete correct URL? If so, make sure that rule is at the top of your `.htaccess` and that your cache is cleared. – Joe Jul 14 '16 at 13:14
  • thank you very much for your kind reply, im updating the post so you can see what is written into the htaccess. – papababa Jul 14 '16 at 13:22
  • OK, move the rule to the top, so it is below `RewriteBase /`. Also, don't forget to reset your cache before you test it. – Joe Jul 14 '16 at 13:29
  • if i put your code to the top, gives me an internal server error – papababa Jul 14 '16 at 13:31
  • hmmm.. put it above `RewriteEngine On` and then add another `RewriteEngine On` and put the rule below that. – Joe Jul 14 '16 at 13:37