0

I have written htaccess file. I want to redirect https://example.com/index.php?route=product/category&path=1 to https://example.com/fashion.

My htaccess is

RewriteEngine On
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

But it is not redirecting to the link I have shown

Prerana
  • 115
  • 14

2 Answers2

0

You may use something like this to redirect all request to your index.php and then manage the requests from there usint*HTTP-PATH. var_dump($_SERVER) to see the actual request.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]

If you want to redirect a specific request, then someone else may help you here later on.

Soley
  • 1,716
  • 1
  • 19
  • 33
  • I have already written this two lines. But still the result is not working. I am using opencart for making this. – Prerana Mar 29 '17 at 08:23
  • do you have the correct name for your htaccess? it should be ".htaccess" not htaccess? – Soley Mar 29 '17 at 08:24
  • Yes I have written .htaccess only. It is reading it if I made any changes – Prerana Mar 29 '17 at 08:26
  • Maybe because you have two extra underlines in your htaccess for ?_route_= instead of ?route= – Soley Mar 29 '17 at 08:28
  • I have tried what u r saying but when I do that the category page is redirected to the main website link. – Prerana Mar 29 '17 at 08:34
0

You may use something like this. I hope this will help you a lot. And if not work visit https://github.com/aice09/htaccess/blob/master/redirects/.htaccess

RewriteEngine On
RewriteRule ^/?category/([^/d]+)/?$ index.php?route=$1 [L,QSA]
Carl Angelo Nievarez
  • 573
  • 1
  • 11
  • 33