samedi 7 septembre 2019

How to rewrite all url using .htaccess in laravel

I have a laravel app. In my app there are some products which are already indexed on google.

I can change products URL through Routes but when a user comes using the google search engine there is a server error because I have changed all product URLs through routes.

Now I am trying to redirect the old URL to the newer by .htaccess

The original URL is www.xxx.com/product/samsung-galaxy-a90.php

I want to redirect it to www.xxx.com/samsung-galaxy-a90

RewriteRule ^product/([0-9a-zA-Z_-]+) product/$1.php [NC,L]

My route is:

Route::get('product/{proslug}.php', 'PostController@singlepro')
    ->name('singlepro');

Now what is the right .htaccess code to do this?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/316h1Nd
via IFTTT

Aucun commentaire:

Enregistrer un commentaire