the php page is not receiving the GET variable and is producing an undefined index error for textSearch.
I’ve turned off multiviews, and added QSA as suggested in related posts.
my .htaccess looks like this
Options -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?id=$1 [QSA,L]
The $_GET variable should be named textSearch
<form action='users/index.php' method"GET">
<input type='text' name='textSearch'>
<input type='submit' value='submit'>
</form>
[EDIT]
As mentioned in the comments, the form’s location is in localhost/Build_3/index.php, and is passing the ‘textSearch’ variable to localhost/Build_3/users/index.php
[EDIT]
Directory structure is as follows:
default home page is Build_3/index.php
user home page is Build_3/users/index.php
The form in Build_3/index.php is supposed to go to Build_3/users/index.php and provide the variable textSearch.
I have one .htaccess in Build_3, and one in the Build_3/users directory.
Add
%{QUERY_STRING}at the end of the rule.Notes:
Options -MultiViewsdoing above?RewriteRule ^(.*)$ index.php?id=$1%{QUERY_STRING} [QSA,L]to work, you need to add some dummy conditions, like I have added above.Update #1
As far as I understood you, correct me if my understanding is wrong:
There is a form in the
Build_3/index.php, which has apostmethod, taking toBuild_3/users/index.php. So I assume that you have the following with you:You have two
.htaccessfiles. Why is there one in theusersdirectory? Okay, I am not sure, why you have one in theBuild_3/then. If you want the users access the URL as:And it should get redirected this way:
Then you need to change your
.htaccessfile in theBuild_3/users/directory this way: