Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can !
Moderator: General Moderators
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Mon Oct 30, 2006 4:23 pm
This is causing a "500 Internal Server Error"... anybody know why?
Code: Select all
Options +FollowSymlinks
RewriteEngine On
#
RewriteCond %{REQUEST_URI} ^/p/(.*)/(.*) [NC]
RewriteRule (.*) /merchant2/merchant.mvc?Screen=PROD&Product_Code=%1&Store_Code=BS [L]
RewriteCond %{REQUEST_URI} ^/pc/(.*)/(.*)/(.*) [NC]
RewriteRule (.*) /merchant2/merchant.mvc?Screen=PROD&Product_Code=%1&Category_Code=%2&Store_Code=BS [L]
RewriteCond %{REQUEST_URI} ^/c/(.*)/(.*) [NC]
RewriteRule (.*) /merchant2/merchant.mvc?Screen=CTGY&Category_Code=%1&Store_Code=BS [L]
Last edited by
Luke on Mon Oct 30, 2006 5:10 pm, edited 1 time in total.
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Mon Oct 30, 2006 4:31 pm
Seems to be working with apache 2.2.3 on winxp.
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Mon Oct 30, 2006 4:34 pm
ok how about this...
this file is in C:\wamp\www\mod_rewrite
Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/s/(.*)/(.*) [NC]
RewriteRule (.*) index.php?Screen=CTGY&Store_Code=BS&Category_Code=%1 [L]
I type in...
http://localhost/mod_rewrite/s/varfoo/varbar and I get a 404 not found... am I doing something wrong?
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Mon Oct 30, 2006 4:46 pm
Doesn't {REQUEST_URI} always contain the whole uri (without protocol and server), i.e. /mod_rewrite/s/varfoo/varbar in this case?
I'm too lazy to test this right now
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Mon Oct 30, 2006 4:52 pm
I don't know... it's confusing as hell though... I've never really built any mod_rewrite rules before. It makes almost no sense to me.
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Mon Oct 30, 2006 5:10 pm
It wasn't my rules... it was the server. Thanks anyways guys!
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Wed Nov 01, 2006 10:50 am
Another quick question... Here is one of my rules...
Code: Select all
RewriteCond %{REQUEST_URI} ^/pc/(.*)/(.*)/(.*) [NC]
RewriteRule (.*) /merchant2/merchant.mvc?Screen=PROD&Store_Code=BS&Category_Code=%1&Product_Code=%2&open_tab=%3 [L]
RewriteCond %{REQUEST_URI} ^/pc/(.*)/(.*)/$ [NC]
RewriteRule (.*) /merchant2/merchant.mvc?Screen=PROD&Store_Code=BS&Category_Code=%1&Product_Code=%2&open_tab=description [L]
What I want is for the third variable is automatically set to "description" if it isn't specified... what I've done above isn't working properly... what am I doing wrong? I really need to work on my regex skills.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Wed Nov 01, 2006 11:24 am
I think you'll have to use another rule
Code: Select all
RewriteCond %{REQUEST_URI} ^/pc/(.*)/(.*)/ [NC]
RewriteRule (.*) /merchant2/merchant.mvc?Screen=PROD&Store_Code=BS&Category_Code=%1&Product_Code=%2&open_tab=description [L]
Above the rest of them
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Wed Nov 01, 2006 11:31 am
This worked...
Code: Select all
RewriteCond %{REQUEST_URI} ^/pc/(.*)/(.*)/(.*)/ [NC]
RewriteRule (.*) /merchant2/merchant.mvc?Screen=PROD&Store_Code=BS&Category_Code=%1&Product_Code=%2&open_tab=%3 [L]
RewriteCond %{REQUEST_URI} ^/pc/(.*)/(.*) [NC]
RewriteRule (.*) /merchant2/merchant.mvc?Screen=PROD&Store_Code=BS&Category_Code=%1&Product_Code=%2&open_tab=description [L]
I just have to add the extra slash at the end if I want to designate the open_tab... which is fine!