htaccess - remove? param =

0

I have this URI: www.miurl.es/productos/producto/nombre?medidas=90x180

I would like to get through .htaccess to have this type of url: www.miurl.es/productos/producto/nombre/90x180 but I can not get it through htaccess. I have looked at some of the rules for these cases but they do not solve me much.

this is the current htaccess:

Options +FollowSymLinks
Options -Indexes

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f


#RewriteCond %{REQUEST_URI} !^/es/
#RewriteCond %{REQUEST_URI} !^/index.php
#RewriteRule (.*) /es/ [R=301,L]

#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !-f 
#RewriteCond %{REQUEST_URI} !(.*).php

RewriteRule (.*) /index.php
RewriteCond %{QUERY_STRING}  ^medidas=$ [NC]
RewriteRule ^(.*)$ $1? [R=301,L]

Options +FollowSymLinks -MultiViews
RewriteEngine on

Any suggestions ???

    
asked by Héktor w3skulls 15.02.2018 в 19:11
source

1 answer

0

Good Hektor here I leave you as it would be:

First of all this you have to do it from a server either with a web or local hosting such as xampp or wampp and have activated the mod_rewrite to make it work.

It is important that in this case I have done it including the .htacces in the same folder as name.php therefore you should do the same or if you want to put it in the parent folder change the route.

# Activar RewriteEngine    
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f

# Reescribir la URL solicitada
# Entrada: nombre/medidas/ (ejemplo: nombre/23x34)
# Salida: nombre.php?medidas=23x34
RewriteRule ^nombre/([a-zA-Z0-9_-]+)$  ./nombre.php?medidas=$1 [L]

I have tested it and it works perfectly any problem you put a comment on me.

Greetings!

    
answered by 15.02.2018 / 21:07
source