Joomla.it Forum

Joomla! 3 => Joomla! 3 => : nofc_nofc 04 Dec 2017, 14:28:57

: Redirect tramite .htaccess
: nofc_nofc 04 Dec 2017, 14:28:57
Salve,
devo fare un banale redirect dal .htaccess che tuttavia non ha buon esito:

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
Redirect https://www.miosito.it/index.php?video=0 https://www.miosito.it/nuovoindirizzocorretto

Qual è l'errore?
Il primo link è una pagina che deve essere ruotata sul secondo link

Impostazioni SEO:
 Attiva URL SEF e Riscrivi URL SEF abilitate.

Neppure con ReDJ funziona :(

: Re:Redirect tramite .htaccess
: Ahmed Salvini 04 Dec 2017, 16:38:08
# Redirect old file path to new file path
Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html
: Re:Redirect tramite .htaccess
: nofc_nofc 04 Dec 2017, 19:02:59
Grazie, purtroppo però non funziona, io credo che il problema sia generato da quest'ultima parte: index.php?video=0 (https://www.miosito.it/index.php?video=0)
non funziona né non ReDJ (altri redirect invece vanno perfettamente) né con htaccess
: Re:Redirect tramite .htaccess
: tomtomeight 04 Dec 2017, 19:59:14
Non ultima parte ma devi mettere solo quella parte.
: Re:Redirect tramite .htaccess
: maicolstaip 04 Dec 2017, 19:59:45
Ciao nofc_nofc,
solo per chiarire, quindi

:
Redirect 301 /index.php?video=0 https://www.miosito.it/nuovoindirizzocorretto
non funziona?
: Re:Redirect tramite .htaccess
: nofc_nofc 04 Dec 2017, 20:08:18
No, in tutte le sue varianti:

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
Redirect 301 /video/index.php?video=0# https://www.miosito.it/it/video/video-documentario
## End - Custom redirects
: Re:Redirect tramite .htaccess
: maicolstaip 04 Dec 2017, 20:12:35
Ciao,
non è che si capisca bene...

sa hai l'/it devi metterlo nel redirect

:
Redirect 301 /it/video/index.php?video=0 https://www.miosito.it/it/nuovoindirizzocorretto
: Re:Redirect tramite .htaccess
: Ahmed Salvini 04 Dec 2017, 20:55:47
il problema è quello che appendi all'url

https://perishablepress.com/redirect-query-string-htaccess/
https://stackoverflow.com/questions/41952767/htaccess-redirect-url-with-dynamic-values-to-homepage
https://stackoverflow.com/questions/17290795/htaccess-redirect-based-on-url-value
: Re:Redirect tramite .htaccess
: maicolstaip 04 Dec 2017, 21:09:44
Giusto Ahmed Salvini,
proverei una cosa così

:
RewriteEngine on
RewriteCond %{THE_REQUEST} /?video=0 [NC]
RewriteRule ^ /nuovoindirizzocorretto [L,R]
: Re:Redirect tramite .htaccess
: nofc_nofc 05 Dec 2017, 10:32:06
## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
RewriteCond %{THE_REQUEST} /?video=0 [NC]
RewriteRule ^ https://www.miosito.it/it/video/video-documentario [L,R]
## End - Custom redirects

Quando vado su https://www.miosito.it/video/index.php?video=0# (vecchio URL) mi reindirizza a https://www.miosito.it/it/video/video-documentario?video=0, quindi parte del redirect ora funziona, tuttavia si aggiunge sul nuovo link la stringa ?video=0, se si riuscisse a toglierla nella nuova URL, il problema sarebbe risolto :)