Web Hosting Forum | Lunarpages
News: November 3, 2008 - Enter Your URL in to WIN the November Site of the Month Award!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 18, 2008, 07:54:17 AM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: mod_rewrite help  (Read 766 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 288 times.)
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3473



« 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

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM