morowind
Posts: 46
|
| Posted: 05/26/2010, 10:33 PM |
|
Try to solve this problem.
I have no idea where to start:
?
someone has been hit by this problem?
any idea is welcome!
|
 |
 |
quasimidi
Posts: 151
|
| Posted: 05/27/2010, 1:05 AM |
|
Hi Morrowind,
First of all, try to search in the forum:
http://forums.codecharge.com/search.php
(search for the keyword: htaccess)
_________________
RS |
 |
 |
morowind
Posts: 46
|
| Posted: 05/27/2010, 6:14 AM |
|
thank's quasimidi,
but I have not found anything about mod_rewrite Login.php redirecting.
Have you find something ?
|
 |
 |
datadoit
|
| Posted: 05/27/2010, 10:02 AM |
|
What exactly are you wanting to rewrite? State your goal and we'll try
to help.
Plethora of other information:
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
|
|
|
 |
morowind
Posts: 46
|
| Posted: 05/27/2010, 10:30 AM |
|
thank's datadoit
I want rewrite url from: http://localhost/Login.php?ret_link=reteived-page.php&type=notLogged
into
http://localhost/login/
so I write a rule in .htaccess file :
RewriteRule ^login(.*)/$ login.php [L] --------(work)
RewriteRule ^login(.*)/$ login.php?ret_link=$1&type=$2 [L] ------ (don't work)
don't work becouse stil show the parameter. The url show like this :
http://localhost/login/?ret_link=reteived-page.php&type=notLogged;
How can I mange to not show that parameters but stil preserve the functionality of script redirects.
I try do my best to explain (poor english lesson) 
|
 |
 |
melvyn
Posts: 333
|
| Posted: 05/27/2010, 8:32 PM |
|
@morowind: That behaviour will occur when you try to access a restricted page without login. Of course we can bypass the variables, with consecuences. If we ignore those variables then we don't know to which page redirect the user if that user try to access a page withot login.
Let me explain:
If the user try to access the link:
morowind.com/admin/invoices.php which is a restricted page, then that user will be redirected to morowind.com/login.php?ret_link=/admin/invoices&type=notLogged which mean: after login send him to invoices.php
Do you want to always send the user to the same page after login?
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
morowind
Posts: 46
|
| Posted: 05/27/2010, 11:39 PM |
|
thank's melvyn.
Let's say I do.
Always send the user to the same page after login.(I will use switch function for every page I want to be redirected if I am be abble to catch that variables.)
In this case it is a way to catch variables "ret_link" and "type" then removed from URL and then redirect ?
shortly:
how to catch and preserve parameters in local variable (I can do that)
and how can I delete those parameters from url (I don't know how)
replacing them with my custom parameters(I don't know how too.)
|
 |
 |
melvyn
Posts: 333
|
| Posted: 05/28/2010, 10:44 PM |
|
Let's work on AfterInitialize event (or maybe BeforeShow)
Quote :how to catch and preserve parameters in local variable (I can do that)
We will check if ret_link and type exist. If they exist, store them on sessions. If they are not set, then clear the value in the session in order to keep it clean.
isset($_GET['ret_link']) ? $_SESSION['ret_link'] = $_GET['ret_link'] : $_SESSION['ret_link'] = "" ;
isset($_GET['type']) ? $_SESSION['type'] = $_GET['type'] : $_SESSION['type'] = "" ;
Next
Quote :and how can I delete those parameters from url (I don't know how)
With a Redirect:
global $Redirect;
$Redirect = "/Login.php"; // or whatever you like your url.
This will clear the arguments.
Quote :replacing them with my custom parameters(I don't know how too.)
??????????
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
morowind
Posts: 46
|
| Posted: 05/31/2010, 3:15 AM |
|
I don't know nothing..
I fell down into another problem..you melvyn ...you are my only hope.
all weekend I read forums my brain burned and still I can't get it :
I have next rule in .htacces file :
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/?$ /classifieds/listitems.php?region=$1&category=$2&title=$3 [L]
Work OK only I have all 3 parameter region/category/title.
If input in my search form only category parameter - that parameters goes to region title goes to category and so...
Next I try :
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?region=([^&]+)(&.*)?$ [NC]
RewriteCond %2&%{QUERY_STRING} ^([^&]+)&(.*&)?category=([^&]+)(&.*)?$ [NC]
RewriteCond %1/%3&%{QUERY_STRING} ^([^&]+)&(.*&)?title=([^&]+)(&.*)?$ [NC]
RewriteRule ^listitems\.php /classifieds/%1/%3/? [R=301,L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/?$ /classifieds/listitems.php?region=$1&category=$2&title=$3 [NC,L]
Works OK but still need to input all three parameter in my search form.
How can I :
search for : - title; -result (http://localhost/classifieds/Mecedes Benz/)
- title and category; -result (http://localhost/classifieds/Vehicle/Mecedes Benz/)
- category; -result (http://localhost/classifieds/Vehicle/)
- category and region; -result (http://localhost/classifieds/Timisoara/Vehicle/)
- region; -result (http://localhost/classifieds/Timisoara)
-region category and title; -result (http://localhost/classifieds/Timisoara/Vehicle/Merceds Benz)
... 
|
 |
 |