Question

Im strugling with some problem with redirecting. I have old link /sklep-borowska and new one /sadzonki/borowka

No I want to redirect with 301 from old one to new on, with url swat to new on if old one is deliverd How can I do that?

Now my htaccess looks like that

RewriteRule ^sadzonki/([0-9a-z-_]+)$ index.php?metoda=linki_seo&id=$1[L]  
RewriteRule ^sadzonki/([0-9a-z-_]+)-([0-9]+)$ index.php?metoda=linki_seo&id=$1&strona=$2[L]
RewriteRule ^sklep-([0-9a-z-_]+)$ index.php?metoda=linki_seo&id=$1 [L]  
RewriteRule ^sklep-([0-9a-z-_]+)-([0-9]+)$ index.php?metoda=linki_seo&id=$1&strona=$2 [L]
Was it helpful?

Solution

Have it like this:

RewriteRule ^sklep-(\w+)/?$ /sadzonki/$1 [L,R=301,NC]

RewriteRule ^sadzonki/([0-9a-z-_]+)$ index.php?metoda=linki_seo&id=$1[L]  
RewriteRule ^sadzonki/([0-9a-z-_]+)-([0-9]+)$ index.php?metoda=linki_seo&id=$1&strona=$2[L]
RewriteRule ^sklep-([0-9a-z-_]+)$ index.php?metoda=linki_seo&id=$1 [L]  
RewriteRule ^sklep-([0-9a-z-_]+)-([0-9]+)$ index.php?metoda=linki_seo&id=$1&strona=$2 [L]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top