Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite w/ multiple variables

         

ca3le

9:24 am on Sep 1, 2010 (gmt 0)

10+ Year Member



Okay, I'm going crazy here.

I'm trying to rewrite ..

http://sitename.x/ipb/topic/10189.msg99496-


simply to

http://sitename.x/ipb/topic/10189-


... all I need to do is drop out the ".msg99496" (the number after .msg is a variable by the way)

what am I doing wrong here...

One of my many attempts to make this work...

RewriteRule ^/ipb/topic/([0-9]+).msg([0-9]+)- /ipb/topic/$1- [NC]


Thanks in advance.

jdMorgan

3:11 pm on Sep 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If your code is in .htaccess, then the path to "this .htaccess file" will be stripped from the URL-path examined by RewriteRule. In simple terms, that means you'll have to remove the leading slash from your RewriteRule pattern.

However, be aware that this is an internal rewrite, and the output must be an existing filepath -- a path to a physically-existing file on your server. This file will be served immediately when the URL-path in the pattern is requested (That is, the code will not redirect the client to a new URL). Because there is no file extension on the substitution path in your RewriteRule, the code (actually, the design) does not seem to be correct.

Jim