Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
April 20, 2014, 11:29:16 AM

Pages: [1]   Go Down
  Print  
Author Topic: mod_rewrite help  (Read 2113 times)
brunofatia
Newbie
*
Offline Offline

Posts: 2


« on: January 22, 2007, 09:25:48 AM »

Greetings,
I've been having some trouble with mod_rewrite, pretty much because in my tests the patterns are ok, but when I write them to my .htaccess apache drives me to my 404. Can anybody help?
Here's the .htaccess located in my /public_html/ (Atleast the part that matters)

Code:
RewriteEngine On

RewriteRule ^search/\?q=(.+)&s=([0-9]+)$ index.php?act=search&q=$1&start=$2 [L]

RewriteRule ^search/?$ index.php?act=search [L]

RewriteRule ^about/?$ index.php?act=about [L]

# Errors rule
RewriteRule ^403/?$ http://www.trancemirror.com/index.php?act=error&id=403 [f,L]
RewriteRule ^404/?$ http://www.trancemirror.com/index.php?act=error&id=404 [L]
RewriteRule ^500/?$ http://www.trancemirror.com/index.php?act=error&id=500 [L]

ErrorDocument 404 http://www.trancemirror.com/404/
ErrorDocument 403 http://www.trancemirror.com/403/
ErrorDocument 500 http://www.trancemirror.com/500/
Problem is at the search rules.. I test my Regular Expressions using a software called "Expresso", an image with my problem is attached.
This rule
Code:
RewriteRule ^search/\?q=(.+)&s=([0-9]+)$ index.php?act=search&q=$1&start=$2 [L]
just doesn't work! I hope somebody can help me with this.
Thanks in advance,
Bruno


* shot2.jpg (45.06 KB, 539x360 - viewed 498 times.)
Logged
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5809



« Reply #1 on: February 18, 2007, 03:02:08 PM »

Looking at the offending line, the only thing that jumps out at me is matching (.+) might eat everything all the way to the end of the line. As it's supposed to stop at &, try this:

RewriteRule ^search/\?q=([^&]+)&s=([0-9]+)$ index.php?act=search&q=$1&start=$2 [L]
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
Pages: [1]   Go Up
  Print  
 
Jump to: