This is a discussion on Mod rewrite and parameters within the Linux Web Servers forums, part of the Web Server and Related Forums category; I have the following .htaccess RewriteEngine On RewriteBase /~hkosmidi/web/ima/admin/ RewriteRule ^.*(\.css)|(\.jpg)|(\.png)|(\.html)|(\.gif)|(\.js) |(\.txt)|(\....
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have the following .htaccess
RewriteEngine On RewriteBase /~hkosmidi/web/ima/admin/ RewriteRule ^.*(\.css)|(\.jpg)|(\.png)|(\.html)|(\.gif)|(\.js) |(\.txt)|(\.ico)$ - [L] RewriteRule ^index.php$ index.php [L] RewriteRule ^companies?err=([0-9])$ index.php?module=companies&err=$1 [L] RewriteRule ^companies$ index.php?module=companies [L] RewriteRule ^categories?err=([0-9])$ index.php?module=categories&err=$1 [L] RewriteRule ^categories$ index.php?module=categories [L] RewriteRule ^compcategory?err=([0-9])$ index.php?module=compcategory&err=$1 [L] RewriteRule ^compcategory$ index.php?module=compcategory [L] RewriteRule ^products?err=([0-9])$ index.php?module=products&err=$1 [L] RewriteRule ^products$ index.php?module=products [L] Now if I say: http://localhost/~hkosmidi/web/ima/admin/categories the appropriate module is loaded. But if I say: http://localhost/~hkosmidi/web/ima/a...tegories?err=1 then I can't $_GET the param from php. The rewrite log has: 127.0.0.1 - - [28/Jan/2008:20:38:54 +0200] [localhost/sid#81da180][rid#838bfe0/initial] (3) [perdir /home/hkosmidi/public_html/web/ima/admin/] applying pattern '^categories?err=([0-9])$' to uri 'categories' 127.0.0.1 - - [28/Jan/2008:20:38:54 +0200] [localhost/sid#81da180][rid#838bfe0/initial] (3) [perdir /home/hkosmidi/public_html/web/ima/admin/] strip per-dir prefix: /home/hkosmidi/public_html/web/ima/admin/categories -> categories 127.0.0.1 - - [28/Jan/2008:20:38:54 +0200] [localhost/sid#81da180][rid#838bfe0/initial] (3) [perdir /home/hkosmidi/public_html/web/ima/admin/] applying pattern '^categories$' to uri 'categories' 127.0.0.1 - - [28/Jan/2008:20:38:54 +0200] [localhost/sid#81da180][rid#838bfe0/initial] (2) [perdir /home/hkosmidi/public_html/web/ima/admin/] rewrite 'categories' -> 'index.php?module=categories' 127.0.0.1 - - [28/Jan/2008:20:38:54 +0200] [localhost/sid#81da180][rid#838bfe0/initial] (3) split uri=index.php?module=categories -> uri=index.php, args=module=categories How can I pass GET params with mod_rewrite? thanks |
|
|||
|
Harris Kosmidis wrote:
> I have the following .htaccess > > RewriteEngine On > RewriteBase /~hkosmidi/web/ima/admin/ > RewriteRule > ^.*(\.css)|(\.jpg)|(\.png)|(\.html)|(\.gif)|(\.js) |(\.txt)|(\.ico)$ - [L] > > RewriteRule ^index.php$ index.php [L] > RewriteRule ^companies?err=([0-9])$ index.php?module=companies&err=$1 [L] > RewriteRule ^companies$ index.php?module=companies [L] > RewriteRule ^categories?err=([0-9])$ index.php?module=categories&err=$1 [L] > RewriteRule ^categories$ index.php?module=categories [L] > RewriteRule ^compcategory?err=([0-9])$ > index.php?module=compcategory&err=$1 [L] > RewriteRule ^compcategory$ index.php?module=compcategory [L] > RewriteRule ^products?err=([0-9])$ index.php?module=products&err=$1 [L] > RewriteRule ^products$ index.php?module=products [L] > > Now if I say: > http://localhost/~hkosmidi/web/ima/admin/categories > > the appropriate module is loaded. > > But if I say: > http://localhost/~hkosmidi/web/ima/a...tegories?err=1 > > then I can't $_GET the param from php. The rewrite log has: > 127.0.0.1 - - [28/Jan/2008:20:38:54 +0200] > [localhost/sid#81da180][rid#838bfe0/initial] (3) [perdir > /home/hkosmidi/public_html/web/ima/admin/] applying pattern > '^categories?err=([0-9])$' to uri 'categories' > 127.0.0.1 - - [28/Jan/2008:20:38:54 +0200] > [localhost/sid#81da180][rid#838bfe0/initial] (3) [perdir > /home/hkosmidi/public_html/web/ima/admin/] strip per-dir prefix: > /home/hkosmidi/public_html/web/ima/admin/categories -> categories > 127.0.0.1 - - [28/Jan/2008:20:38:54 +0200] > [localhost/sid#81da180][rid#838bfe0/initial] (3) [perdir > /home/hkosmidi/public_html/web/ima/admin/] applying pattern > '^categories$' to uri 'categories' > 127.0.0.1 - - [28/Jan/2008:20:38:54 +0200] > [localhost/sid#81da180][rid#838bfe0/initial] (2) [perdir > /home/hkosmidi/public_html/web/ima/admin/] rewrite 'categories' -> > 'index.php?module=categories' > 127.0.0.1 - - [28/Jan/2008:20:38:54 +0200] > [localhost/sid#81da180][rid#838bfe0/initial] (3) split > uri=index.php?module=categories -> uri=index.php, args=module=categories > > > How can I pass GET params with mod_rewrite? > > > thanks The query string is not part of the object examined by a RewriteRule. Read up on RewriteCond and find examples that look at %{QUERY_STRING}. You should find examples in the history of this newsgroup via google. Jim |
| Thread Tools | |
| Display Modes | |
|
|