homepage Welcome to WebmasterWorld Guest from 50.17.107.233
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
mod_rewrite / php problem
Crazy_Fool




msg:1503816
 1:27 pm on Mar 27, 2003 (gmt 0)

i don't use mod_rewrite very often and i've spent all morning banging my head against a brick wall on this. i've read hundreds of messages here and not found the answer.

my htaccess file looks like this:

Options Includes +ExecCGI
AddType text/x-server-parsed-html .html
RewriteEngine on
Options +FollowSymlinks

RewriteBase /
RewriteRule items/(.*)\.html$ [mydomain.com...]
RewriteRule (.*)/(.*)\.html$ [mydomain.com...]

the first rule works fine, the second doesn't.
the second rule should rewrite:
www.mydomain.com/widgets/123.html
to:
www.mydomain.com/index.php?category=widgets&s=123

index.php displays normally, but the value of category ($1)becomes the first (.*) plus everything within (.*)/(.*)\.html and s is empty
ie, if i enter the URL:
www.mydomain.com/widgets/123.html
then my script says that:
$category = widgetswidgets/123.htmls=123
$s = (empty)

any idea what i'm doing wrong? any help much appreciated.

 

andreasfriedrich




msg:1503817
 1:45 pm on Mar 27, 2003 (gmt 0)

Try using negative character classes like so:


RewriteRule [httpd.apache.org] ([^/]+)/([^/]+)\.html$ index.PHP [php.net]?category=$1&s=$2

You do not need to prefix [thishost...] since it will be stripped off by mod_rewrite [httpd.apache.org] anyway.

Andreas

Crazy_Fool




msg:1503818
 9:05 pm on Mar 27, 2003 (gmt 0)

nope, that doesn't fix it .... seems to work exactly the same as before

i've also discovered that the first line works fine when it's the only RewriteRule line or if the second is commented out, but when the second RewriteRule is there, the first one messes up the same.

any other clues?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved