1
highlander
.htaccess Rewriterule for the ? character
  • 2005/12/6 19:58

  • highlander

  • Not too shy to talk

  • Posts: 151

  • Since: 2004/12/5


Hi All,

I have a non-xoops site which I have converted into a XOOPS site. All the content has been migrated into the new database and all is well.

I used the information in this thread to make sure that when 'old' content was accessed the user would be led to the new location.

the problem lies with the following line :
RewriteRule ^viewtopic.php?topic=([0-9]+)&forum=([0-9]+) /modules/newbb/viewtopic.php?topic_id=$1&forum=$[L]

This does not work as expected because of the ? character in the first part which is throwing things off. (the ? is a regular expression quantifier; or so google has told me)

So the question is how can I redirect my users to the right place if the first bit can't have a ? character in it. Or is there a way to escape the ? character ???

Kind regards, Highlander
So, I'm in the park wondering why frisbees get larger as they get closer when suddenly, it hits me...
http://www.AnimalPedigree.com

2
highlander
Re: .htaccess Rewriterule for the ? character
  • 2005/12/6 21:48

  • highlander

  • Not too shy to talk

  • Posts: 151

  • Since: 2004/12/5


*FIXED*

I am not quite sure why but I could only do this simple rewrite with the following code :

RewriteCond %{QUERY_STRING} ^topic=([0-9]+)&forum=([0-9]+)$
RewriteRule viewtopic.php /modules/newbb/viewtopic.php?topic_id=%1&forum=%[L]


I hope someone else will one day be helped by this.

Greetings Highlander

p.s. the escape charatar is an \
So, I'm in the park wondering why frisbees get larger as they get closer when suddenly, it hits me...
http://www.AnimalPedigree.com

3
jayjay
Re: .htaccess Rewriterule after migrating from non-xoops site
  • 2007/6/7 7:17

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


Quote:

highlander wrote:
*FIXED*

I am not quite sure why but I could only do this simple rewrite with the following code :

RewriteCond %{QUERY_STRING} ^topic=([0-9]+)&forum=([0-9]+)$
RewriteRule viewtopic.php /modules/newbb/viewtopic.php?topic_id=%1&forum=%[L]


I hope someone else will one day be helped by this.

Greetings Highlander

p.s. the escape charatar is an \


This is a great solution! I couldn't find a solution too, but this saved my day

I have migrated from phpbb to cbb and I used this code to rewrite url's:
RewriteCond %{QUERY_STRING} ^t=([0-9]+)(.*)$  
RewriteRule viewtopic.php /modules/newbb/viewtopic.php?topic_id=%1%[R,L]

Login

Who's Online

299 user(s) are online (217 user(s) are browsing Support Forums)


Members: 0


Guests: 299


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits