Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Mod-rewrite con ASP senza .htaccess

    Premetto che non so se questo è il posto giusto (eventualmente spostatemi) in quanto la mia domanda è a cavallo tra ASP, SEO, gestione server, e crossbrowsing (si scrive così?).
    Devo fare un mod-rewrite su un server ASP che non supporta .htaccess, vorrei provare con il seguente codice.
    codice:
    <%
    	perc=Request.ServerVariables("QUERY_STRING")
    	par =Split(perc, "/")
    	npar=ubound(par)
    
    	testo=""
    	pag="404"
    
    	if npar=-1 then pag="home"
    	if npar=1 then
    		if par(1)="" then pag="contatti"
    		if par(1)="contatti.htm" then pag="contatti"
    		if par(1)="aboutus.htm" then pag="aboutus"
    	end if
    	if npar=2 then
    		if par(1)="articoli" then
    			if par(2)="tutto-su-php.htm" then pag="php"
    			if par(2)="tutto-su-asp.htm" then pag="asp"
    			if par(2)="tutto-su-java.htm" then pag="java"
    		end if
    	end if
    
    	if pag="404" then
    		Response.Status = 404
    		testo="Errore 404"
    	end if
    
    	if pag="home" then testo="Home page"
    	if pag="contatti" then testo="Contatti"
    	if pag="aboutus" then testo="Chi siamo"
    	if pag="php" then testo="Tutto su php"
    	if pag="asp" then testo="Tutto su asp"
    	if pag="java" then testo="Tutto su java"
    %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Prova mod rewrite asp</title>
    </head>
    	
    
    Menu:
    		Home | Contatti | Chi siamo
    	</p>
    	
    
    Articoli:
    		Tutto su php | Tutto su asp | Tutto su java
    	</p>
    	<h1><% response.write(testo) %></h1>
    <body>
    </body>
    </html>
    Il miei quesiti sono i seguenti.
    1) I link così creati funzioneranno con tutti i browser? Io ho provato con i principali e mi funziona.
    2) A livello SEO il "?" crea problemi?

    Ciao a tutti
    Utilità per studenti e ingegneri - https://www.engtools.online/

  2. #2
    Sì, funzionerà su tutti i browser in quanto il codice ASP viene esguito sul tuo server, ai browser degli utenti verrà inviato solo html.
    Il "?" problemi non ne crea ma dopo il ? si parla di querystring che è una cosa diversa dall'url rewrite.

  3. #3
    Grazie per la celere risposta.
    Prima non ho specificato che tale codice dovrebbe andare su index.asp piazzato su root del sito.

    Il mio problema è che in questo modo ottengo i seguenti indirizzi URL
    www.miosito.it/?/contatti.htm
    www.miosito.it/?/articoli/tutto-su-php.htm
    etc...

    probabimente, come mi dici, il ? non dovrebbe creare problema al browser in quanto indica un parametro anche se non è del tipo ?id=... ma è del tipo ?/...
    E a livello SEO ciò può essere equivalente ad un mod-rewrite?

    Ciao
    Utilità per studenti e ingegneri - https://www.engtools.online/

  4. #4
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,131
    Leggi qui forse può aiutarti.
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.