Reputation: 121
I have a project for modification, where I need to post a form with get, but I am unable to get the post value.
after checking I determine that .htaccess causing problem for this, please help me on this so I get the value without affecting the existing functionality of site.
this is .htaccess file
RewriteRule ^/?([a-zA-Z0-9_+-\s+]+)$ ?x=$1 [QSA,L]
RewriteRule ^/?([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)$ ?x=$1&y=$2
RewriteRule ^/?([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)$ ? x=$1&y=$2&z=$3
RewriteRule ^/?([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)$ ?x=$1&y=$2&z=$3&u=$4
RewriteRule ^/?([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)$ ?x=$1&y=$2&z=$3&u=$4&v=$5
RewriteRule ^/?([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)$ ?x=$1&y=$2&z=$3&u=$4&v=$5&w=$6
RewriteRule ^/?([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)$ ?x=$1&y=$2&z=$3&u=$4&v=$5&w=$6&a=$7
RewriteRule ^/?([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)/([a-zA-Z0-9_+-\s+]+)$ ?x=$1&y=$2&z=$3&u=$4&v=$5&w=$6&a=$7&b=$8
eg : http://www.exampledomain.com/result?term=sampleterm
in this the $_GET['x'] value is result, but I am unable to get term value
Upvotes: 1
Views: 68
Reputation: 785008
You actually need QSA
flag (Query String Append), and its better to use L
(Last) flag also.
RewriteRule ^/?([\w\s+-]+)/?$ ?x=$1 [QSA,L]
RewriteRule ^/?([\w\s+-]+)/([\w\s+-]+)/?$ ?x=$1&y=$2 [L,QSA]
RewriteRule ^/?([\w\s+-]+)/([\w\s+-]+)/([\w\s+-)/?$ ?x=$1&y=$2&z=$3 [L,QSA]
RewriteRule ^/?([\w\s+-]+)/([\w\s+-]+)/([\w\s+-]+)/([\w\s+-]+)/?$ ?x=$1&y=$2&z=$3&u=$4 [L,QSA]
# rest of the rules here...
QSA flag makes sure to append existing query string in the new query parameter you're adding through your rules.
Upvotes: 1