Debt Consolidation - Loan - Wp themes - Online Advertising - Expekt bonuses

PDA

View Full Version : Mod_Rewrite help


PhilipB
Feb 12th 2005, 10:01 am
RewriteEngine On
RewriteRule ^forums.* /index.php


RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).* /viewforum.php?f=$1&topicdays=$2&start=$3
RewriteRule ^mforum([0-9]*).* /viewforum.php?f=$1&mark=topic
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 ^newtopic([0-9]*).* /viewtopic.php?t=$1&view=newest
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]*)-([0-9]*)-([a-zA-Z]*)-([a-zA-Z]*).* /viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5
RewriteRule ^ftopic([0-9]*)-([0-9]*).* /viewtopic.php?t=$1&start=$2
RewriteRule ^ftopic([0-9]*).* /viewtopic.php?t=$1
RewriteRule ^sutra([0-9]*).* /viewtopic.php?p=$1

This is what I have in my .htaccess file but my forum pages dont work.

http://www.must-have-software.net/forum/forum2.php

I re-did the mod_rewrite mod but still does the same thing :confused:

piniyini
Feb 12th 2005, 10:06 am
Well the first thing i would say is more precise with the extensions

try the folowing for each one

RewriteRule ^ftopic([0-9]*).php$ /viewtopic.php?t=$1 [L]

I aint no expert but i would say that it should work

PhilipB
Feb 12th 2005, 10:28 am
Tried it, doesn't work :(

PhilipB
Feb 12th 2005, 10:31 am
I also had to add this to my page header.php in the includes folder

ob_start();
function replace_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;view=newest'",
"'(?<!/)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\?p=([0-9]*)'");

$urlout = array(
"viewforum\\1-\\2-\\3.php",
"mforum\\1.php",
"forum\\1.php",

"ptopic\\1.php",
"ntopic\\1.php",
"newtopic\\1.php",
"ftopic\\1-\\2-\\3-\\4.php",
"ftopic\\1-\\2-\\3-\\4-\\5.php",
"ftopic\\1-\\2.php",
"ftopic\\1.php",
"sutra\\1.php");

$s = preg_replace($urlin, $urlout, $s);

return $s;
}

piniyini
Feb 12th 2005, 11:02 am
The requested URL /viewtopic.php was not found on this server.

Maybe you should have

RewriteRule ^ftopic([0-9]*).php$ /forum/viewtopic.php?t=$1 [L]

PhilipB
Feb 12th 2005, 11:10 am
Tried it and it doesn't work. But I can go to http://www.must-have-software.net/forum/viewforum.php?f=46 just fine...? (I typed it in to see...)

PhilipB
Feb 13th 2005, 9:06 am
Bump, anyone know?

justicewhite
Feb 15th 2005, 3:22 pm
Try mod-rewrite*com/forum.

I've had quite useful feedback and managed to get my mod rewrite problem resolved.

Good luck...

iktorn
Feb 16th 2005, 4:43 am
Do you get Internal Error 500 ?

nullbit
Feb 20th 2005, 2:13 pm
Haven't really looked at the regex, but (just guessing), is the forum located in a sub-directory (e.g. somsite.com/forum/), and is the .htaccess file located in a higher directory?

If so, add:

RewriteBase path/to/forum


Also check your apache error logs from a SSH shell:

cat /var/log/httpd/error_log | tail