Forum Moderators: phranque

Message Too Old, No Replies

Please check my RewriteRules, It looks right, but won't work.

.htaccess

         

XtremeWebProductions

6:51 am on Jan 14, 2006 (gmt 0)

10+ Year Member



Hello, I have a problem with my RewriteRule.
It looks like it should be right, but it doesnt seem to work proporly.

I currently Have THIS:
RewriteRule ^/([^/]+)/([^/]+)/? /index.php?something=$1&somethingelse=$2

Please tell me if I am doing this incorrectly, but what I want is for the address /filename/anotherfilename/ to redirect to the index.php?something=filename&somethingelse=anotherfilename page with the file names as seprate variables to be used in index.php

Thanks!

jdMorgan

5:23 pm on Jan 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The URLs 'seen' by RewriteRule in .htaccess are localized to the current directory. Therefore, the leading slash will be stripped, so your rule will never match. Try:

RewriteRule ^([^/]+)/([^/]+)/?$ /index.php?something=$1&somethingelse=$2 [L]

I assume you also have the RewriteEngine on and Options directives ahead of this code to enable mod_rewrite.

Jim

XtremeWebProductions

1:03 am on Jan 17, 2006 (gmt 0)

10+ Year Member



Thank you Jim, and actually, I ended up being able to figure this out myself. Glad to see it worked, my code was actually identical to yours here.

Marcus

Ps. Yes, I had RewriteEngine on at the first line of the document.