Fork me on GitHub




(1) 2 »


URL Rewriting chez 1and1 ?
Régulier
Inscrit: 07/09/2006 11:23
De So So Far
Messages: 478
Bonjour,

Je me permet de monter un autre sujet, si ceci est déjà réussit par quelqu'un de nous.

J'ai bien lu un article :
https://www.frxoops.org/modules/news/article.php?storyid=971
et j'ai essayé de suivre, mais ça ne marche toujours pas. J'ai même fait des recherches de tous les moteurs, ... toujours sans succès.

je me demande si URL Rewriting est toujours possible sous XOOPX ???

Quelqu'un peut m'aider ???

MONOROOM

Posté le : 07/09/2007 02:43

Un rêve se réalise quand on tente à  le faire
[Monde de plaisir]:[Magazine enligne] - [Troupe Théâtre]
Partager Twitter Partagez cette article sur GG+
Re: URL Rewriting chez 1and1 ?
Xoops accro
Inscrit: 25/02/2004 00:20
De Région parisienne
Messages: 2526
Tu peux nous donner plus d'info ???
- les liens sont-ils bien réécrit dans xoops ?
- les redirections du fichier htaccess fonctionne-t-elle ?
- etc...

Posté le : 07/09/2007 02:58
Partager Twitter Partagez cette article sur GG+
Re: URL Rewriting chez 1and1 ?
Régulier
Inscrit: 07/09/2006 11:23
De So So Far
Messages: 478
Merci pour ta réponse.


En fait je voulais remettre tous URL de mon site en URL Rewriting. Si j'ai bien compris dans l'article, je crée le fichier .htaccess avec le code :

Options +FollowSymLinks
RewriteEngine On
RewriteBase 
/
#RewriteCond %{REQUEST_URI} .*.htm$
#RewriteRule ^(.*).htm $1.php [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule 
^.*.(htm|htmlloadpage.php [L]
RewriteRule ^$ loadpage.php [L]


Après upload ce fichier dans la racine du site, rien ne se passe ou la page affichée Erreur 404 ...

Citation :
- les redirections du fichier htaccess fonctionne-t-elle ?


Normalement je cois que oui !
J'ai déjà fait dans le module Edito de Solo71.

Merci encore pour les aides.
MONOROOM

Posté le : 07/09/2007 12:00

Un rêve se réalise quand on tente à  le faire
[Monde de plaisir]:[Magazine enligne] - [Troupe Théâtre]
Partager Twitter Partagez cette article sur GG+
Re: URL Rewriting chez 1and1 ?
Xoops accro
Inscrit: 25/02/2004 00:20
De Région parisienne
Messages: 2526
le fichier simplified_url.php est-il inclus dans le mainfile.php et à la racine de ton site ???
include "simplified_url.php";


pour le htacess, j'utilise quelque chose de plus simple, attention le / devant loadpage.php est spécifique à OVH
RewriteEngine on

RewriteCond 
%{REQUEST_FILENAME}   !-s
RewriteRule 
^.*.(htm|html) [b][color=cc0000]/[/color][/b]loadpage.php [L]
RewriteRule ^$ [b][color=cc0000]/[/color][/b]loadpage.php [L]

Posté le : 07/09/2007 12:36
Partager Twitter Partagez cette article sur GG+
Re: URL Rewriting chez 1and1 ?
Régulier
Inscrit: 07/09/2006 11:23
De So So Far
Messages: 478
Je ne sais rien de simplified_url.php

Est ce que est un fichier qui est composé de :
<?php
// $Id: simplified_url.php,v 1.5 2005/07/02 17:15:00 suin Exp $
//  ------------------------------------------------------------------------ //
//              SIMPLIFIED URLs FOR XOOPS based on ShortURLs                 //
//              Copyright (c) 2004 suin and Reynaldo Alvarez                 //
//                         <http://www.suin.jp>  &nb ... nbsp;   //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  ------------------------------------------------------------------------ //
// 
if (!defined("XOOPS_ROOT_PATH") || !defined("XOOPS_URL") ) {
    exit();
}
// ´Ê°×²½¤ò̵¸ú¤Ë¤¹¤ë¥â¥¸¥å¡¼¥ë
// "|"¤Ç¥â¥¸¥å¡¼¥ë¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò¶èÀڤ롣 If you do not want to simplify any module, divide the module's dir with "|".

$cancel_module "";
//$cancel_module = "xoopspoll|newbb|news";

if( !empty( $cancel_module ) && isset( $sd_res ) ){
    if( ( 
preg_match("//modules/(".$cancel_module.")//"$_SERVER['SCRIPT_NAME']) )){
        
header('Location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
        exit();
    }
}
if(  ( !
preg_match("//modules/([^/]*)/admin//"$_SERVER['SCRIPT_NAME']) ) 
  && ( !
preg_match("//modules/system//"$_SERVER['SCRIPT_NAME']) )
  && ( !
preg_match("/admin.php/"$_SERVER['SCRIPT_NAME']) )  ) {
    
//ob_start('ob_gzhandler');
    //ob_start('absolutize');
    
ob_start('simplify_urls');
}else{
    if( isset( 
$sd_res ) ){
        
header('Location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
        exit();
    }
}

function 
simplify_urls($s
{
    
$XPS_URL str_replace('/','/'quotemeta(XOOPS_URL) );
    
$s absolutize($s); 
    
// Fix URLs and HTML.    //if (strpos($s, "storyid")) {




//include_once XOOPS_ROOT_PATH."/modules/news/class/class.newsstory.php";
//include_once XOOPS_ROOT_PATH.'/modules/news/class/class.sfiles.php';
//include_once XOOPS_ROOT_PATH.'/modules/news/include/functions.php';
//include_once XOOPS_ROOT_PATH."/modules/news/class/class.newstopic.php";
//include_once XOOPS_ROOT_PATH."/modules/news/class/keyhighlighter.class.php";
//$newsStory = new NewsStory($storyid);
//$title=urlencode($newsStory->title);
//$s .= "&title=".urlencode($newsStory->title);

//}
preg_match('/(storyid=)(.*)(.*)/iUs',$s$recherche);
    
$storyid $recherche[2];    
$title null;
global 
$xoopsDB;
$sql "SELECT title FROM ".$xoopsDB->prefix("stories")." WHERE storyid = ".intval($storyid);
if (
$res $xoopsDB->query($sql)) {
   if (
$oRS mysql_fetch_object($res)) {
      
$title $oRS->title;
   }
}

if (
$title) {
$s str_replace("news-article.storyid-([a-zA-Z0-9_-]+).htm""article-$1-$title.htm"$s);
   
$s .= "&title=".urlencode($title);
}
    
$in = array(
        
// Search URLs of Xoops's root directry.
          
'/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/([a-zA-Z0-9_-]+).php(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '
/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '/<(a|meta)([^>]*)(href|url)=(['"
]{0,1})'.$XPS_URL.'/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        // Search URLs of modules' directry.
                                                                  
        
'/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '
/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
           , '/<(a|meta)([^>]*)(href|url)=(['"
]{0,1})'.$XPS_URL.'/modules/news/article.php?storyid=([a-zA-Z0-9_-]*)&title=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'    

        
'/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
            , '
/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '/<(a|meta)([^>]*)(href|url)=(['"
]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        
'/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '
/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '/<(a|meta)([^>]*)(href|url)=(['"
]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
    
);
    
    
$out = array(
        
// Replace URLs of Xoops's root directry.
          
'<$1$2$3=$4'.XOOPS_URL.'/$5.html$6$7$8>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5.$6-$7.html$8$9$10>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5.$6-$7-$8-$9.html$10$11$12>'
        
// Replace URLs of modules' directry.
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-index.htm$6$7$8>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.htm$7$8$9>'
         
'<$1$2$3=$4'.XOOPS_URL.'/article-$5-$6.htm$7$8$9>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8.htm$9$10$11>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8-$9-$10.htm$11$12$13>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8-$9-$10-$11-$12.htm$13$14$15>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8-$9-$10-$11-$12-$13-$14.htm$15$16$17>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8-$9-$10-$11-$12-$13-$14-$15-$16.htm$17$18$19>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8-$9-$10-$11-$12-$13-$14-$15-$16-$17-$18.htm$19$20$21>'
    
);


    



    
$s preg_replace($in$out$s); 
//    $s = preg_replace('/<([^>]*)>/i','{\1}', $s);
//    $s = $s.'<!-- Simplified URLs Version 1.1 http://www.suin.jp/ -->';
    
return $s;    
}

function 
absolutize($s){
    if(
preg_match('//$/',$_SERVER['REQUEST_URI'])){
        
$req_dir=preg_replace('//$/','',$_SERVER['REQUEST_URI']);
        
$req_php="";
    }else{
        
$req_dir=dirname($_SERVER['REQUEST_URI']);
        
$req_php=preg_replace('/.*(/[a-zA-Z0-9_-]+).php.*/','\1.php',$_SERVER['REQUEST_URI']);
    }
    
$req_dir = ($req_dir == "\" || $req_dir == "/" ) ? "" $req_dir ;
    
$dir_arr=explode('/'$req_dir);
    
$m count($dir_arr)-1;
    
$d1 = @str_replace('/'.$dir_arr[$m],   ''$req_dir);
    
$d2 = @str_replace('/'.$dir_arr[$m-1], ''$d1);
    
$d3 = @str_replace('/'.$dir_arr[$m-2], ''$d2);
    
$d4 = @str_replace('/'.$dir_arr[$m-3], ''$d3);
    
$d5 = @str_replace('/'.$dir_arr[$m-4], ''$d4);
    
$host 'http://'.$_SERVER['HTTP_HOST'];
    
$in = array(
         
'/<([^>?&]*)(href|src|action|background|window.location)=([^"' >]+)([^>]*)>/i'
//off1        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})../../../../../([^"']*)(["']{1})([^>]*)>/i'
//off2        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})../../../../([^"']*)(["']{1})([^>]*)>/i'
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})../../../([^"']*)(["']{1})([^>]*)>/i'
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})../../([^"']*)(["']{1})([^>]*)>/i'
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})../([^"']*)(["']{1})([^>]*)>/i'
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})/([^"']*)(["']{1})([^>]*)>/i'
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})?([^"']*)(["']{1})([^>]*)>/i'
        //This dir
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})(?:./)?([^"'/:]*/*)?([^"'/:]*/*)?([^"'/:]*/*)?([a-zA-Z0-9_-]+).([^"'>]*)(["']{1})([^>]*)>/i'
        
,'/[^"'a-zA-Z_0-9](window.open|url)((["']{0,1})(?:./)?([^"'/]*).([^"'/]+)(["']*)([^)]*)/i'
        ,'/<meta([^>]*)url=([a-zA-Z0-9_-]+).([^"'>]*)(["'
]{1})([^>]*)>/i'
    );
    $out = array(
         '
<\1\2="\3"\4>'
//off1        ,'
<\1\2=\3'.$host.$d5.'/\4\5\6>'
//off2        ,'
<\1\2=\3'.$host.$d4.'/\4\5\6>'
        ,'
<\1\2=\3'.$host.$d3.'/\4\5\6>'
        ,'
<\1\2=\3'.$host.$d2.'/\4\5\6>'
        ,'
<\1\2=\3'.$host.$d1.'/\4\5\6>'
        ,'
<\1\2=\3'.$host.'/\4\5\6>'
        ,'
<\1\2=\3'.$host.$_SERVER['PHP_SELF'].'?\4\5\6>'
        //This dir.
        ,'
<\1\2=\3'.$host.$req_dir.'/\4\5\6\7.\8\9\10>'
        ,'
$1($2'.$host.$req_dir.'/$3.$4$5$6'
        ,'
<meta$1url='.$host.$req_dir.'/$2.$3$4$5>'
    );


    $s = preg_replace($in, $out, $s); 
//off3    z$s = preg_replace('
/<([^>]*)>/i','{\1}', $s);
    
    return $s;
}
?>


Et ce code ci :

include "simplified_url.php";


Je le met où dans mainfile.php??

merci encore
MONOROOM

Posté le : 07/09/2007 12:59

Un rêve se réalise quand on tente à  le faire
[Monde de plaisir]:[Magazine enligne] - [Troupe Théâtre]
Partager Twitter Partagez cette article sur GG+
Re: URL Rewriting chez 1and1 ?
Xoops accro
Inscrit: 25/02/2004 00:20
De Région parisienne
Messages: 2526
oui tu met l'include juste avant
define('XOOPS_CHECK_PATH'0);

Posté le : 07/09/2007 13:02
Partager Twitter Partagez cette article sur GG+
Re: URL Rewriting chez 1and1 ?
Régulier
Inscrit: 07/09/2006 11:23
De So So Far
Messages: 478
Je pense que j'ai bien suivi.

voila ce qu'il donne;

www.monsite.com/news+index.html sur le barre d'adresse
et Erreur 404 sur écran

Ca peut etre du fichier .htacess ou simplified_url.php qui n'est pas compatible avec Xoops 2.0.17 ???

Merci pour les aides
MONOROOM

Posté le : 07/09/2007 13:55

Un rêve se réalise quand on tente à  le faire
[Monde de plaisir]:[Magazine enligne] - [Troupe Théâtre]
Partager Twitter Partagez cette article sur GG+
Re: URL Rewriting chez 1and1 ?
Régulier
Inscrit: 07/09/2006 11:23
De So So Far
Messages: 478
Où peut-être ça devient de 1and1???

Posté le : 07/09/2007 14:01

Un rêve se réalise quand on tente à  le faire
[Monde de plaisir]:[Magazine enligne] - [Troupe Théâtre]
Partager Twitter Partagez cette article sur GG+
Re: URL Rewriting chez 1and1 ?
Aspirant
Inscrit: 27/07/2004 16:41
De Din ch'nord
Messages: 95
Monoroom,

Commençe par vérifier si le module rewrite est actif en créant une page vierge : test.php mets y un echo de quelque choe.

Place ensuite le fichier test.php à la racine de ton site.

Puis tu ajoute à ton htaccess cette règle:

RewriteRule ^test\.html$ /test.php [NC]

Ensuite dans ton navigateur tu tape

tonsite.tld/test.html


Si le mode rewrite est actif chez 1&1, tu devrais avoir le contenu de ton test.php


++
Belugha.

Posté le : 09/09/2007 15:05

BeluInfo : Dépannage Informatique íƒÂ  domicile et création de site internet.
ATM, Pose et décoration de plafond tendu : Rewriting actif - Xoops 2.0.16 - Gabarit Morph
Partager Twitter Partagez cette article sur GG+
Re: URL Rewriting chez 1and1 ?
Régulier
Inscrit: 07/09/2006 11:23
De So So Far
Messages: 478
Merci a belugha

Ok je vais voir ca de suite.
Et je te tiendrai au courrant

A+

Posté le : 10/09/2007 01:47

Un rêve se réalise quand on tente à  le faire
[Monde de plaisir]:[Magazine enligne] - [Troupe Théâtre]
Partager Twitter Partagez cette article sur GG+

 Haut   Précédent   Suivant
(1) 2 »



Vous pouvez voir les sujets.
Vous ne pouvez pas débuter de nouveaux sujets.
Vous ne pouvez pas répondre aux contributions.
Vous ne pouvez pas éditer vos contributions.
Vous ne pouvez pas effacez vos contributions.
Vous ne pouvez pas ajouter de nouveaux sondages.
Vous ne pouvez pas voter en sondage.
Vous ne pouvez pas attacher des fichiers à vos contributions.
Vous ne pouvez pas poster sans approbation.

Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

63 Personne(s) en ligne (62 Personne(s) connectée(s) sur Forum) | Utilisateur(s): 0 | Invité(s): 63 | Plus ...