tags:

views:

19

answers:

1

How htaccess syntax?

I have 3 files (php) a. premium.php

b. direktori2.php

c. direktori_det2.php

this Flow:

  1. example.com/AbelPutra-com (inside premium.php) and i direct to direktori2.php file

    ---> RewriteRule ^([A-Za-z0-9-()/&]+)/?$ direktori2.php?NamaToko=$1 [NC,L]

    this is OK

  2. example.com/AbelPutra-com/Modern-Karaoke (inside direktori2.php) and I direct to direktori_det2.php file

    ---> RewriteRule ^([A-Za-z0-9-()/&]+)/([A-Za-z0-9-()/&]+)/?$ direktori_det2.php?NamaToko=$1&NamaProduk=$1 [NC,L]

    *this is Problem *

    or this error Syntax?

When I running in number 2, server read with rewrite in number 1 (always read number 1)

How to fix? Thank you very much before

A: 

Without detailed looking into this rule I found this mistake:

RewriteRule ^([A-Za-z0-9-()/&]+)/([A-Za-z0-9-()/&]+)/?$ direktori_det2.php?NamaToko=$1&NamaProduk=$2

You use NamaProduk=$1 instead of NamaProduk=$2.

Roman
@Roman; thank you. I've tried it, but still could not
Abel
The easiest way is just to swap them, so RewriteRule #2 should come first in .htaccess file.
Roman
@Abel, it seems to be working OK now...
Roman
@Roman, wow....its working...thank you very much.... Its surprise for me...hahaha...
Abel
@Abel, you're welcome. You can also rewrite your rules to make sure they match only one URL type, but rearranging them works OK (as in this case).
Roman
@Roman. Ok.ok...thanks for your kind attention and advice..(sorry my english bad hehe..)
Abel
Roman, can you give me solution for my other problem? http://stackoverflow.com/questions/3986271/httaccess-primary-domain-ok-but-addon-domain-be-problem
Abel