WRInaute occasionnel
bonjour
j'ai lu tous les posts concernant l'url rewriting et ovh mais je n'ai pas trouvé mon boheure
voila j'ai fait la modif
mais cela affiche une page 404 lorsque je veux alller sur un post du forum la page index ne fait pas de 404
j'ai fait ainsi www.example.com/forum/index.php
et lorsque je veux aller sur un post du forum
http://www.example.com/forum/forum1.html
mais page 404
merci de m'aider
si je me suis mal exprimé
posez moi des questions
:wink:
j'ai lu tous les posts concernant l'url rewriting et ovh mais je n'ai pas trouvé mon boheure
voila j'ai fait la modif
Code:
Voici la méthode vu dans ce fameux post, en faite on trouve la bonne solution sur 2 posts, j'ai suivit exactement celle-ci-dessous pour obtenir un forum phpbb url rewrité en quelques minutes de modification des fichiers concernés en ftp et sans connaissances de php...
Acid Paul wrote:
I have modified the Googlifier mod for PHPNuke with PHPBB2 port found at www.orientalgate.org to work with standalone PHPBB2. This mod allows you to turn dynamic forum urls into static ones and therefore get better indexed and ranked by Google & co., as well as picked by search engines, that don't like dynamic URLs (e.g. AllTheWeb).
The effect is like this:
> viewtopic.php?t=157 => ftopic28.html
(affects all topics, posts, forum folders and pagination; member profiles, search, lorgin and usergroups URL stay unchanged; the main page remains index.php)
Requirements: you need mod_rewrite enabled as well as ability to use .htaccess or modify apache config files.
Implementation:
Step 1. In /includes/page_header.php before
Code:
//
// Generate logged in/logged out status
//
add this code (make sure there are no space breaks at line ends after you paste):
Code:
//
// Short URL implementation
//
ob_start();
function replace_for_mod_rewrite(&$s)
{
$urlin =
array(
"'(?<!/)viewforum.php\?f=([0-9]*)&(?:amp;)topicdays=([0-9]*)&(?:amp;)start=([0-9]*)'",
"'(?<!/)viewforum.php\?f=([0-9]*)&(?:amp;)mark=topics'",
"'(?<!/)viewforum.php\?f=([0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)view=previous'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)view=next'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)postdays=([0-9]*)&(?:amp;)postorder=([a-zA-Z]*)&(?:amp;)start=([0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)start=([0-9]*)&(?:amp;)postdays=([0-9]*)&(?:amp;)postorder=([a-zA-Z]*)&(?:amp;)highlight=([a-zA-Z0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)start=([0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)'",
"'(?<!/)viewtopic.php&(?:amp;)p=([0-9]*)'",
"'(?<!/)viewtopic.php\?p=([0-9]*)'",
);
$urlout = array(
"viewforum\\1-\\2-\\3.html",
"forum\\1.html",
"forum\\1.html",
"ptopic\\1.html",
"ntopic\\1.html",
"ftopic\\1-\\2-\\3-\\4.html",
"ftopic\\1.html",
"ftopic\\1-\\2.html",
"ftopic\\1.html",
"sutra\\1.html",
"sutra\\1.html",
);
$s = preg_replace($urlin, $urlout, $s);
return $s;
}
Step 2. In /includes/page_tail.php after
Code:
$db->sql_close();
add this:
Code:
$contents = ob_get_contents();
ob_end_clean();
echo replace_for_mod_rewrite($contents);
global $dbg_starttime;
in the same file after
Code:
ob_end_clean();
add this:
Code:
echo replace_for_mod_rewrite($contents);
global $dbg_starttime;
Step 3. In your .htaccess file (if you don't have one create it; should be located in you forum root directory) paste these lines:
Code:
RewriteEngine On
RewriteRule ^forums.* index.php
RewriteRule ^forum([0-9]*).* viewforum.php?f=$1&mark=topic
RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).* viewforum.php?f=$1&topicdays=$2&start=$3
RewriteRule ^forum([0-9]*).* viewforum.php?f=$1
RewriteRule ^ptopic([0-9]*).* viewtopic.php?t=$1&view=previous
RewriteRule ^ntopic([0-9]*).* viewtopic.php?t=$1&view=next
RewriteRule ^ftopic([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).* viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4
RewriteRule ^ftopic([0-9]*)-([0-9]*).* viewtopic.php?t=$1&start=$2
RewriteRule ^ftopic([0-9]*).* viewtopic.php?t=$1
RewriteRule ^ftopic([0-9]*).html viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5
RewriteRule ^sutra([0-9]*).* viewtopic.php?p=$1
Note: sometimes this .htaccess code won't work properly if the forum is on a subdomain (was the case with me), you may need to try this variation:
Code:
RewriteEngine On
RewriteRule ^forums.* /index.php
RewriteRule ^forum([0-9]*).* /viewforum.php?f=$1&mark=topic
RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).* /viewforum.php?f=$1&topicdays=$2&start=$3
RewriteRule ^forum([0-9]*).* /viewforum.php?f=$1
RewriteRule ^ptopic([0-9]*).* /viewtopic.php?t=$1&view=previous
RewriteRule ^ntopic([0-9]*).* /viewtopic.php?t=$1&view=next
RewriteRule ^ftopic([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).* /viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4
RewriteRule ^ftopic([0-9]*)-([0-9]*).* /viewtopic.php?t=$1&start=$2
RewriteRule ^ftopic([0-9]*).* /viewtopic.php?t=$1
RewriteRule ^ftopic([0-9]*).html /viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5
RewriteRule ^sutra([0-9]*).* /viewtopic.php?p=$1
Step 4. Very important! In your robots.txt file (goes at the *site* root) add these lines:
Code:
Disallow: /your-forum-folder/sutra*.html$
Disallow: /your-forum-folder/ptopic*.html$
Disallow: /your-forum-folder/ntopic*.html$
Disallow: /your-forum-folder/ftopic*asc*.html$
(This is required to avoid feeding duplicate content to Google)
Step 5. Apply Google Mod #1 described at this page.
Congrats! Now you now have traffic-generating mogul.
mais cela affiche une page 404 lorsque je veux alller sur un post du forum la page index ne fait pas de 404
j'ai fait ainsi www.example.com/forum/index.php
et lorsque je veux aller sur un post du forum
http://www.example.com/forum/forum1.html
mais page 404
merci de m'aider
si je me suis mal exprimé
posez moi des questions
:wink: