Web Hosting Forum | Lunarpages

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

Login with username, password and session length
May 23, 2015, 06:59:30 AM

Pages: [1]   Go Down
Author Topic: mod_rewrite help  (Read 2266 times)
Offline Offline

Posts: 2

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

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)

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
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,

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

Posts: 5991

« 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]

Visit My Site

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