Welcome to WebmasterWorld Guest from 184.108.40.206 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Mod Rewrite - Hopelessly Lost.... Need a pointer please... Nick_W
Pulling my hair out here:
I'm trying to turn this:
Into somthing reasonable like:
I have this so far, but I'm almost embarrassed to post it ;)
rewriteEngine On rewriteRule ~viewtopic\.php/$ /viewtopic.php?t=$1
The ~ is actually a carrot, but for some astonishing reason my keyboard refuses to print one!
If someone can put me on the right track I'm sure I can work it out, I'd appreciate a jump start though ;)
RewriteRule ^(.*)viewtopic/(.*).html /viewtopic.php?t=$2 Nick_W
Why the $2?
And much thanks, very decent of you ;)
The second variable is the one you want to match.
I had to make up for my phpBB mod posting!
Hmmm... I fear I'm missing somthing? RewriteEngine On RewriteRule ^(.*)viewtopic/(.*).html /viewtopic.php?t=$2
When I click a topic, it just goes to the regular url. Did I miss somthing?
Do you have the pattern and substitution mixed up? <edit>NO, you don't.<edit> [ edited by: coopster at 9:14 pm (utc) on Sep. 18, 2003] bcolflesh
You need to change the physical URLs to the format:
where x=your number - try the link:
The link works, heh! ---- Is there an easy way of changing those urls in phpBB? -- sounds painfull....
Should only take a few seconds with a text search and replace tool - check the code on one of the pages and see how they construct the links.
It's probably a worthwhile task to make a complete rewrite guide for phpBB, given all the users...
Thanks, I'll get too it.
I suppose the main files are just viewforum.php and viewtopic.php right?
DId you bother with the '?start=x' urls aswell?
Since a rewrite guide project is being suggested, I'd like to note that since the $1 backreference is not used, and since the pattern starts with a wild card, this code RewriteEngine On RewriteRule ^(.*)viewtopic/(.*).html /viewtopic.php?t=$2 could just as well be shortened/simplified to RewriteEngine On RewriteRule viewtopic/(.*)\.html /viewtopic.php?t=$1 [L] (Note also the escaped period in "\.html", and stick a [L] flag on there unless you have a reason not to do so.)