Pass variable forbidden because of htaccess file
.htaccess, html, php
Solution
RewriteRule ^B2C/(.*)/$ index.php?lang=$1 [QSA]
The `[QSA]` flag appends the query string (in your case, `abc`) to this rule. Currently, your rule ignores the query string that was passed and uses only the `lang`, etc. variables. For this to apply to all of your rules, each rule needs this flag at the end.
From the mod_rewrite documentation:
Modifying the Query String
By default, the query string is passed through unchanged. You can, however, create URLs in the substitution string containing a query string part. Simply use a question mark inside the substitution string to indicate that the following text should be re-injected into the query string. When you want to erase an existing query string, end the substitution string with just a question mark. To combine new and old query strings, use the [QSA] flag.
Problem
This is my second post because i also can't find the solution so I am looking forward to your help. My company website has been created by a resigned staff. He used the htaccess file to exchange all of the link in website. And now, when I want to pass a variable from one page to second page via address bar, the second page can't GET the variable because of the affect of htaccess. Anyone can help me to find the solution to revise the htaccess when i had tiny experience of htaccess file. Here is htacess file. ``` RewriteEngine On Options All -Indexes DirectoryIndex index.php RewriteRule ^index\.html$ index.php RewriteRule ^B2C/(.*)/(.*)/(.*).html$ index.php?lang=$1&p=$2&id=$3 RewriteRule ^B2C/(.*)/(.*).html$ index.php?lang=$1&p=$2 RewriteRule ^B2C/(.*)/$ index.php?lang=$1 RewriteRule ^postoffice.html$ more/PO.php RewriteRule ^hospital-clinic.html$ more/HO.php ErrorDocument 401 /errors/401.html ErrorDocument 403 /errors/403.html ErrorDocument 404 /errors/404.html ErrorDocument 500 /errors/500.html AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch bMSIE !no-gzip !gzip-only-text/html ``` Here is my code in tag which want to pass the variable $main_po_num in page "1" ``` echo "<td><a href='B2C/$lang/Contact_detail.html?abc=$main_po_num'>$main_po_num</a></td>"; ``` Here is code I vardump in page "2" which return NULL (meaning can't Get the pass variable) ``` var_dump ($_GET["abc"]); ``` Even the address bar can display the variable .64.4:1234/B2C/vi/Customer_Contact?abc=S110023845.html So how can i revise the htacess then i can pass and get the variable between 2 page. THANKS