Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [inne]Zmiana / usunięcie z linku "/pl" htaccess
kubax33
post 13.09.2016, 11:27:58
Post #1





Grupa: Zarejestrowani
Postów: 157
Pomógł: 1
Dołączył: 27.01.2010

Ostrzeżenie: (0%)
-----


Witam,
mam sklep na preście i mam problem z linkami ponieważ google pobrało takie linki:

www.nazwa-sklepu.pl/pl/jakis-produkt-210.html

a w tej chwili usunąłem polską wersję i linki są bez pl/:

www.nazwa-sklepu.pl/jakis-produkt-210.html

teraz problem jest taki, że klient wchodzący z google otrzymuje stronę z błędem 404 ponieważ ona nie istnieje.

Do momentu zindeksowania chciałbym, aby klient trafiał na poprawną stronę, a dzięki htaccess w linku był usuwany "/pl"

Probowałem tak:

  1. RewriteRule ^pl/$1 / [L]


ale nic nie daje
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
trueblue
post 13.09.2016, 11:30:08
Post #2





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


Kod
RewriteCond %{REQUEST_URI} ^/pl/(.+).html
RewriteRule ^(.*)$ http://%{HTTP_HOST}/%1.html [R=301,L]



--------------------
Go to the top of the page
+Quote Post
kubax33
post 13.09.2016, 11:57:18
Post #3





Grupa: Zarejestrowani
Postów: 157
Pomógł: 1
Dołączył: 27.01.2010

Ostrzeżenie: (0%)
-----


Super działa, ale teraz dla strony kategorii mam problem zrobiłem tak:

  1. RewriteCond %{REQUEST_URI} ^/pl/(.+).html
  2. RewriteRule ^(.*)$ http://%{HTTP_HOST}/%1.html [R=301,L]
  3.  
  4. RewriteCond %{REQUEST_URI} ^/pl/
  5. RewriteRule ^(.*)$ http://%{HTTP_HOST}/%1 [R=301,L]
  6.  


link do kategorii wygląda tak:

www.nazwa-strony.pl/288-nazwa-kategorii
Go to the top of the page
+Quote Post
trueblue
post 13.09.2016, 12:02:07
Post #4





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


RewriteCond %{REQUEST_URI} ^/pl/(.+)

W ten sposób możesz również wyrzucić pierwszą regułę.


--------------------
Go to the top of the page
+Quote Post
kubax33
post 13.09.2016, 12:06:30
Post #5





Grupa: Zarejestrowani
Postów: 157
Pomógł: 1
Dołączył: 27.01.2010

Ostrzeżenie: (0%)
-----


Dzięki działa jak należy.

  1. RewriteCond %{REQUEST_URI} ^/pl/(.+).html
  2. RewriteRule ^(.*)$ http://%{HTTP_HOST}/%1.html [R=301,L]
  3.  
  4. RewriteCond %{REQUEST_URI} ^/pl/(.+)
  5. RewriteRule ^(.*)$ http://%{HTTP_HOST}/%1 [R=301,L]
  6.  
Go to the top of the page
+Quote Post
trueblue
post 13.09.2016, 12:15:38
Post #6





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


Pierwsza reguła nie jest potrzebna.


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 05:04