0

I have a big problem with 2 rewrite rules :

RewriteRule ^video/([^/]*)/([^/]*)/$ /fiche.php?id=$2 [L]
RewriteRule ^user/([^/]*)/([^/]*)/$ /user.php?id=$2 [L]

The first rule work perfectly, the "$2" give me right "$_GET['id']" !

But the second rule, when i dump "$_GET", this variable seems to be empty.

But, i don't know why, i have tried with "$1, $2, $3" but "$_GET" is empty all the time !

Any ideas ?

**** EDIT ****

Array (
    [USER] => ************
    [FCGI_ROLE] => RESPONDER 
    [APP_ENGINE_VERSION] => 5.4 
    [APP_ENGINE] => php 
    [ENVIRONMENT] => production 
    [UNIQUE_ID] => *********************************
    [GEOIP_COUNTRY_CODE] => FR 
    [GEOIP_COUNTRY_NAME] => France 
    [GEOIP_REGION] => B8 
    [GEOIP_CITY] => Biot 
    [GEOIP_DMA_CODE] => 0 
    [GEOIP_AREA_CODE] => 0 
    [GEOIP_LATITUDE] => ****************** 
    [GEOIP_LONGITUDE] => ******************** 
    [SCRIPT_URL] => /user/whyj/3/ 
    [SCRIPT_URI] => http://SITENAME.tv/user/whyj/3/ 
    [CFG_CLUSTER] => ************ 
    [HTTP_REMOTE_IP] => *****************
    [HTTP_HOST] => SITENAME.tv 
    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0 
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
    [HTTP_ACCEPT_LANGUAGE] => fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3 
    [HTTP_ACCEPT_ENCODING] => gzip, deflate 
    [HTTP_REFERER] => http://SITENAME.tv/fr/ 
    [HTTP_COOKIE] => ******************************************************
    [HTTP_CONNECTION] => keep-alive 
    [SERVER_SIGNATURE] => 
    [SERVER_SOFTWARE] => Apache 
    [SERVER_NAME] => SITENAME.tv 
    [SERVER_ADDR] => *************** 
    [SERVER_PORT] => 80 
    [REMOTE_ADDR] => *****************
    [DOCUMENT_ROOT] => /home/************/www/SITENAME 
    [SERVER_ADMIN] => postmaster@SITENAME.tv 
    [SCRIPT_FILENAME] => /home/************/www/SITENAME/user.php 
    [REMOTE_PORT] => 63334 
    [REMOTE_USER] => coucou 
    [AUTH_TYPE] => Basic 
    [GATEWAY_INTERFACE] => CGI/1.1 
    [SERVER_PROTOCOL] => HTTP/1.1 
    [REQUEST_METHOD] => GET 
    [QUERY_STRING] => 
    [REQUEST_URI] => /user/whyj/3/ 
    [SCRIPT_NAME] => /user.php 
    [PATH_INFO] => /whyj/3/ 
    [PATH_TRANSLATED] => /homez.38/************/www/SITENAME/whyj/3/ 
    [PHP_SELF] => /user.php/whyj/3/ 
    [REQUEST_TIME_FLOAT] => 1443773143.8235 
    [REQUEST_TIME] => 1443773143 
    [argv] => Array ( ) 
    [argc] => 0 ) 

Thank you !

  • You are looking for the `QSA` flag for the RewriteRules. Take a look at the documentation: it is very well written, has lots of good information and examples: http://httpd.apache.org/docs/current/mod/mod_rewrite.html – arkascha Oct 01 '15 at 06:28
  • `$_GET['id']` is a string, not an array. What are you trying to do exactly and what is the url you are using? – jeroen Oct 01 '15 at 06:30
  • arkascha : Ty, i'm going to look ! – Ludovic Cardinale Oct 01 '15 at 06:38
  • jeroen : yes, i would say : $_GET is an empty array ! I try to get a dynamic page with the correct id to show a specific page from bdd. – Ludovic Cardinale Oct 01 '15 at 06:38
  • Why give me a -1 for my question ? -_- seriously ? This is a question !! Stupid guy ! – Ludovic Cardinale Oct 01 '15 at 07:49
  • Sorry for duplicate post ! I have edit this one ! – Ludovic Cardinale Oct 02 '15 at 08:13
  • See [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](http://stackoverflow.com/a/31280108) for common pitfalls. This is clearly MultiViews taking the request path over before mod_rewrite. Which is why PATH_INFO is populated, but QUERY_STRING ain't. – mario Oct 02 '15 at 08:15
  • ... So, i'm just a french begginer with url rewriting, so i don't understand what i have to do :/ – Ludovic Cardinale Oct 02 '15 at 08:31

0 Answers0