Redirection 301 friendly url

0

Create a friendly URL like this:

RewriteRule ^productos Productos.php [NC,L]

but now I want to make a 301 redirect to midominio.com/Productos.php so that whenever I type Productos.php redirects me to midominio.com/productos

    
asked by ger 10.07.2018 в 04:49
source

1 answer

2

In htaccess you could do it with Redirect, keep in mind that you must go before the previous rule so that products can be directed to Productos.php. You can see more info here .

Redirect 301 /Productos.php /productos

On the other hand, the normal thing is that it is not accessed by Productos.php because all the links to your page should lead to products.

You can also do it in php:

if($_SERVER["REQUEST_URI"]=="Productos.php"){
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: midominio.com/productos");
    header("Connection: close");
    exit;
}
    
answered by 10.07.2018 / 09:04
source