Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite help

rule does not track the pattern and skip it

         

phparion

7:38 am on Jan 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi

I have URLs like

http://www.example.com/keyword/variable/variabledigit1-variabledigit2.html

I want to redirect this url to process.php?did=digit1&id=digit2

for this i tried the following rewrite url in htaccess file but it does nor read the URL pattern,

RewriteCond %{REQUEST_URI} ^/keyword/(.+)/(.+)-(.+)\.html/$
RewriteRule ^/keyword/(.+)/(.+)-(.+)\.html/$ process.php?did=$2&id=$3 [L]

Can anybody help me please how to make this rule to catch the URL pattern?

thank you

jdMorgan

4:41 pm on Jan 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> for this i tried the following rewrite url in htaccess file but it does nor read the URL pattern,

The RewriteCond is redundant. It is not needed. I commented it out.


# RewriteCond %{REQUEST_URI} ^/keyword/(.+)/(.+)-(.+)\.html/$
#
# Change rule pattern to match htaccess local URL-path, eliminate inefficient ".*" patterns
RewriteRule ^keyword/([^/]+)/([^-]+)-([^.]+)\.html/?$ process.php?did=$2&id=$3 [L]

Jim

phparion

5:31 am on Jan 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thank you Jim. Though my previous rule also worked for me. I moved it above few other rules and it started to work i guess it had to do with other rules.

But thanks for giving a more efficient rule.