URL Rewritting sur URL externe

Questions sur la configuration d'Apache, httpd.conf, et les différents modules.

Modérateur : Modérateurs

Avatar de l’utilisateur
guilhem_mdg
Membre
Membre
Messages : 14
Inscription : mar. 30 mai 2006, 16:40

Messagepar guilhem_mdg » jeu. 01 juin 2006, 16:10

Code : Tout sélectionner

   #
    # AddType allows you to tweak mime.types without actually editing it, or to
    # make certain files to be certain types.
    #
    AddType application/x-tar .tgz
    AddType image/x-icon .ico
    AddType application/vnd.wap.wmlc .wmlc
    AddType application/x-httpd-php .phtml .pwml .php3 .php4 .php .php2 .inc
    AddType text/vnd.wap.wml .wml
    AddType text/vnd.wap.wmlscript .wmls
    AddType text/vnd.wap.wmlscriptc .wmlsc
    AddType image/vnd.wap.wbmp .wbmp

    #
    # AddHandler allows you to map certain file extensions to "handlers",
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action command (see below)
    #
    # If you want to use server side includes, or CGI outside
    # ScriptAliased directories, uncomment the following lines.
    #
    # To use CGI scripts:
    #
    AddHandler cgi-script .cgi

    #
    # To use server-parsed HTML files
    #
    AddType text/html .shtml
    AddHandler server-parsed .shtml

    #
    # Uncomment the following line to enable Apache's send-asis HTTP file
    # feature
    #
    #AddHandler send-as-is asis

    #
    # If you wish to use server-parsed imagemap files, use
    #
    #AddHandler imap-file map

    #
    # To enable type maps, you might want to use
    #
    #AddHandler type-map var

</IfModule>
# End of document types.

#
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
# Format: Action media/type /cgi-script/location
# Format: Action handler-name /cgi-script/location
#

#
# MetaDir: specifies the name of the directory in which Apache can find
# meta information files. These files contain additional HTTP headers
# to include when sending the document
#
#MetaDir .web

#
# MetaSuffix: specifies the file name suffix for the file containing the
# meta information.
#
#MetaSuffix .meta

#
# Customizable error response (Apache style)
#  these come in three flavors
#
#    1) plain text
#ErrorDocument 500 "The server made a boo boo.
#  n.b.  the single leading (") marks it as text, it does not get output
#
#    2) local redirects
#ErrorDocument 404 /missing.html
#  to redirect to local URL /missing.html
#ErrorDocument 404 /cgi-bin/missing_handler.pl
#  N.B.: You can redirect to a script or a document using server-side-includes.
#
#    3) external redirects
#ErrorDocument 402 http://some.other-server.com/subscription_info.html
#  N.B.: Many of the environment variables associated with the original
#  request will *not* be available to such a script.

#
# Customize behaviour based on the browser
#
<IfModule mod_setenvif.c>

    #
    # The following directives modify normal HTTP response behavior.
    # The first directive disables keepalive for Netscape 2.x and browsers that
    # spoof it. There are known problems with these browser implementations.
    # The second directive is for Microsoft Internet Explorer 4.0b2
    # which has a broken HTTP/1.1 implementation and does not properly
    # support keepalive when it is used on 301 or 302 (redirect) responses.
    #
    BrowserMatch "Mozilla/2" nokeepalive
    BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

    #
    # The following directive disables HTTP/1.1 responses to browsers which
    # are in violation of the HTTP/1.0 spec by not being able to grok a
    # basic 1.1 response.
    #
    BrowserMatch "RealPlayer 4\.0" force-response-1.0
    BrowserMatch "Java/1\.0" force-response-1.0
    BrowserMatch "JDK/1\.0" force-response-1.0

</IfModule>
# End of browser customization directives

#
# Allow server status reports, with the URL of http://servername/server-status
# Change the "localhost" to match your domain to enable.
#
#<Location /server-status>
#    SetHandler server-status
#    Order deny,allow
#    Deny from all
#    Allow from localhost
#</Location>

#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the "localhost" to match your domain to enable.
#
#<Location /server-info>
#    SetHandler server-info
#    Order deny,allow
#    Deny from all
#    Allow from localhost
#</Location>

#
# There have been reports of people trying to abuse an old bug from pre-1.1
# days.  This bug involved a CGI script distributed as a part of Apache.
# By uncommenting these lines you can redirect these attacks to a logging
# script on phf.apache.org.  Or, you can record them yourself, using the script
# support/phf_abuse_log.cgi.
#
#<Location /cgi-bin/phf*>
#    Deny from all
#    ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi
#</Location>

#
# Proxy Server directives. Uncomment the following lines to
# enable the proxy server:
#
#IfModule mod_proxy.c>
    ProxyRequests On
    <Directory proxy:*>
        Order deny,allow
        Deny from all
        Allow from localhost
    </Directory>

    #
    # Enable/disable the handling of HTTP/1.1 "Via:" headers.
    # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
    # Set to one of: Off | On | Full | Block
    #
#    ProxyVia On

    #
    # To enable the cache as well, edit and uncomment the following lines:
    # (no cacheing without CacheRoot)
    #
#    CacheRoot "C:/Program Files/Apache Group/Apache/proxy"
#    CacheSize 5
#    CacheGcInterval 4
#    CacheMaxExpire 24
#    CacheLastModifiedFactor 0.1
#    CacheDefaultExpire 1
#    NoCache a-domain.com another-domain.edu joes.garage-sale.com

#</IfModule>
# End of proxy directives.

### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at <URL:http://www.apache.org/docs/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
#NameVirtualHost *

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

#alias
#alias


Avatar de l’utilisateur
jean@adimp.ch
Membre avancé
Membre avancé
Messages : 72
Inscription : mer. 16 mars 2005, 12:05

Messagepar jean@adimp.ch » jeu. 01 juin 2006, 16:34

Salut,
Tu peux tout d'abord enlever le commentaire de "<IfModule mod_proxy.c>".
et ensuite ajoute:


Code : Tout sélectionner

NameVirtualHost *
<VirtualHost *>
    ServerAdmin vraiment_les_choses_se_font@toutes_seules.com
    ServerName www.site1.com
    ServerAlias site1.com
    RewriteEngine On
    RewriteLogLevel 1
    RewriteRule http://www.site1.com/^/(.*) http://www.site2.com/saucisse/$1 [L,P]
    ErrorLog logs/site1.com-error_log
    CustomLog logs/site1-access_log common
</VirtualHost>

à la fin de ton fichier.

Bonne chance.
A+.
-----------------------------------------------
Meilleures salutations
http://www.t-servi.com

Avatar de l’utilisateur
guilhem_mdg
Membre
Membre
Messages : 14
Inscription : mar. 30 mai 2006, 16:40

Messagepar guilhem_mdg » jeu. 01 juin 2006, 17:12

Hum encore un grand merci mais cela ne marche toujours pas....
J'ai mis:

Code : Tout sélectionner

NameVirtualHost *
<VirtualHost *>
   ServerAdmin vraiment_les_choses_se_font@toutes_seules.com
   ServerName localhost/projet1/test/
   ServerAlias localhost/projet1/test/
   RewriteEngine On
   RewriteLogLevel 1
   RewriteRule http://localhost/projet1/test/^/(.*) http://www.google.com/$1 [L,P]
   ErrorLog logs/site1.com-error_log
   CustomLog logs/site1-access_log common
</VirtualHost>

En fait cette solution de modifier le httpd.conf ne me convient pas beaucoup car je n'ai pas envi de modifier le httpd.conf car il ne se trouve pas sur mon serveur...

Une autre solution ?
:(

Avatar de l’utilisateur
jean@adimp.ch
Membre avancé
Membre avancé
Messages : 72
Inscription : mer. 16 mars 2005, 12:05

Messagepar jean@adimp.ch » ven. 02 juin 2006, 10:12

Salut,
Si tu ne veux pas modifier ton httpd.conf, tu ne peux pas utiliser apache comme proxy.
Tu as d'autres solutions, c'est d'utiliser un script php qui s'occupe de récupérer et d'afficher les pages voulues., ou d'utiliser un proxy php, ou de passer par des frame.
<a href='http://www.onlamp.com/pub/a/php/2004/01/22/php_proxy.html' target='_blank'>http://www.onlamp.com/pub/a/php/2004/01/22/php_proxy.html</a>

A+.
-----------------------------------------------

Meilleures salutations

http://www.t-servi.com

Avatar de l’utilisateur
guilhem_mdg
Membre
Membre
Messages : 14
Inscription : mar. 30 mai 2006, 16:40

Messagepar guilhem_mdg » mar. 06 juin 2006, 10:30

Bonjour,
Désolé pour le temps de ma réponse mais le week-end est passé par là... ;-)
Peux-tu m'en dire davantage sur les solutions alternatives que tu proposes car le lien est en anglais...
Merci. :unsure:

Avatar de l’utilisateur
jean@adimp.ch
Membre avancé
Membre avancé
Messages : 72
Inscription : mer. 16 mars 2005, 12:05

Messagepar jean@adimp.ch » mar. 06 juin 2006, 13:27

Salut,
Est-ce que tu connais <a href='http://www.google.com' target='_blank'>http://www.google.com</a>?
Et si tu tapais proxy ou socket sur <a href='http://fr.wikipedia.org/wiki/Accueil' target='_blank'>http://fr.wikipedia.org/wiki/Accueil</a>?
Peut-être en sauras-tu plus là : <a href='http://nepomiachty.developpez.com/extraction_donnees/index4.php' target='_blank'>http://nepomiachty.developpez.com/extracti...nees/index4.php</a>
A+.
-----------------------------------------------

Meilleures salutations

http://www.t-servi.com


Revenir vers « Configuration »

Qui est en ligne ?

Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 1 invité