How do I make URL Friendly + 301 Redirect with . htaccess?

Asked

Viewed 56 times

1

I have a site with thousands of pages with no URL friendly, so I want to put this feature..

My site currently looks like this: https://www.meusite.com.br/? pag=videos I want him like this: https://www.meusite.com.br/videos

I followed this path and it works!

RewriteEngine On
RewriteRule ^([0-9A-Za-z]+)$ index.php?pag=$1

However, the thousands of pages still continue with the old link and I won’t be able to change manually, so I thought I’d redirect 301 via. htaccess, but I can’t understand regular expressions to unify the above friendly url + 301 redirect in the links below:

https://www.meusite.com.br/?pag=noticias
https://www.meusite.com.br/?pag=noticias-exibe&news=nova-noticia-aqui

I took a look at the article from Agency which is more or less what I need, however, when I mix the old links with the new ones, it gets something like this and every time I click on these old links, they add more parameters to the initial links...

https://www.meusite.com.br/videos?pag=noticias?pag=videos?pag=dicas
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.