[HELP] How to change query search variable...

RizyGFX

Graphics Designer
Feb 26, 2018
132
106
Hey so im working on some features for my hotel and i was wondering how to remove the ?search= variable from search bar so it just did url/home/{username} and not url/home/?search={username}

btw if i remove name"search" code no longer works...


HTML:
<!-- The form -->
<form class="example" action="{url}/home/">
  <input type="text" placeholder="Search.." name="search">
  <button type="submit"><i class="fa fa-search"></i></button>
</form>
 

Attachments

  • 1570547768025.png
    1570547768025.png
    358.7 KB · Views: 22

JayC

Always Learning
Aug 8, 2013
5,493
1,398
The variable in the URL is using a GET request for the form. You need to change it to instead use a POST request, and send the data over
 

RizyGFX

Graphics Designer
Feb 26, 2018
132
106
you could use url rewriting like so:
Code:
RewriteRule ^home/(.*)$ home.php?search=$1 [QSA,L]

this is my current code for rewrite could you modify it and let me know.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>                   
            <rule name="Imported Rule 69">
<match url="^home/([a-zA-Z0-9_-]+)(|/)$" ignoreCase="false" />
<action type="Rewrite" url="index.php?url=home&amp;user={R:1}" appendQueryString="false" />
</rule>
                <rule name="Imported Rule 1">
                    <match url="^(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?url={R:1}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 2">
                    <match url="^([a-zA-Z0-9_-]+)(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?url={R:1}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 3">
                    <match url="^(.*)\.htm$" />
                    <action type="Rewrite" url="{R:1}.php" />
                </rule>
                <rule name="Imported Rule 4">
                    <match url="^(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="dash.php?page={R:1}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 5">
                    <match url="^([a-zA-Z0-9_-]+)(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="dash.php?url={R:1}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 6">
                    <match url="^(community/staff)$" ignoreCase="false" />
                    <action type="Rewrite" url="staff" />
                </rule>
                <rule name="Imported Rule 7">
                    <match url="^home/([a-zA-Z0-9_-]+)(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?url=home&amp;user={R:1}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 8">
                    <match url="^profile(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="profile.php" />
                </rule>
                <rule name="Imported Rule 9">
                    <match url="^profile/([^/]+)(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="./profile.php?web-profile-tab={R:1}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 10">
                    <match url="^(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="/index.php?url={R:1};" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 11">
                    <match url="^([a-zA-Z0-9_-]+)(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="/index.php?url={R:1};" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 12">
                    <match url="^(.*)\.htm$" ignoreCase="false" />
                    <action type="Rewrite" url="/{R:1}.php;" />
                </rule>
                <rule name="Imported Rule 13">
                    <match url="^(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="/dash.php?page={R:1};" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 14">
                    <match url="^([a-zA-Z0-9_-]+)(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="/dash.php?url={R:1};" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 15">
                    <match url="^me/novote(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?url=me&amp;novote={R:1}" appendQueryString="false" />
                </rule>   
              <rule name="Imported Rule 17">
                <match url="^home/([a-zA-Z0-9_-]+)(|/)$" ignoreCase="false" />
                <action type="Rewrite" url="index.php?url=home&amp;user={R:1}" appendQueryString="false" />
              </rule>
              
                 <rule name="Imported Rule 97">
                <match url="^home/([a-zA-Z0-9_-]+)(|/)$" ignoreCase="false" />
                <action type="Rewrite" url="index.php?url=profile&amp;user={R:1}" appendQueryString="false" />
              </rule>
              <rule name="Imported Rule 18" stopProcessing="true">
                <match url="^news/(.*)/?$" ignoreCase="false" />
                <action type="Rewrite" url="index.php?url=news&amp;id={R:1}" appendQueryString="true" />
              </rule>
                <rule name="Imported Rule 19" stopProcessing="true">
                <match url="^account/([a-zA-Z0-9_-]+)(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?url=account&amp;tab={R:1}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 20" stopProcessing="true">
                <match url="^badgeshop/([a-zA-Z0-9_-]+)(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?url=badgeshop&amp;tab={R:1}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 21">
                    <match url="^me/novote(|/)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?url=me&amp;novote={R:1}" appendQueryString="false" />
                </rule>   
                 <rule name="Imported Rule 16">
                    <match url="^habbo-imaging/badge/([^/]+)$" ignoreCase="false" />
                    <action type="Rewrite" url="/habbo-imaging/badge.php?badge={R:1}" appendQueryString="false" />
                </rule>
                <rule name="Redirect to HTTP" stopProcessing="true">
                    <match url="(.*)" />
                        <conditions>
                        <add input="{R:1}" pattern="^onepage/(.*)$" negate="true" />
                        <add input="{HTTPS}" pattern="^ON$" />
                        </conditions>
                    <action type="Redirect" url="http://{HTTP_HOST}/{R:0}" redirectType="Permanent" />
                </rule>
                <rule name="RequestBlockingRule1" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTP_USER_AGENT}" pattern="Wordpress" />
                    </conditions>
                    <action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
                </rule>
                <rule name="rule 1T">
                    <match url="^news/([a-zA-Z0-9_-]+)(|/)$"  />
                    <action type="Rewrite" url="/index.php?url=news&amp;id={R:1}"  />
                </rule>
                <rule name="rule 2T">
                    <match url="^account/([a-zA-Z0-9_-]+)(|/)$"  />
                    <action type="Rewrite" url="/index.php?url=account&amp;tab={R:1}"  />
                </rule>
                <rule name="rule 3T">
                    <match url="^shop/([a-zA-Z0-9_-]+)(|/)$"  />
                    <action type="Rewrite" url="/index.php?url=shop&amp;tab={R:1}"  />
                </rule>
                <rule name="rule 4T">
                    <match url="^badgeshop/([a-zA-Z0-9_-]+)(|/)$"  />
                    <action type="Rewrite" url="/index.php?url=badgeshop&amp;tab={R:1}"  />
                </rule>
                <rule name="rule 1Y">
    <match url="^home/([a-zA-Z0-9_-]+)(|/)$"  />
    <action type="Rewrite" url="/index.php?url=home&amp;user={R:1}"  />
</rule>
<rule name="Habbo Imaging Group Badges">
          <match url="^habbo-imaging/badge/([^/]+)" ignoreCase="false" />
          <action type="Rewrite" url="/habbo-imaging/badge.php?badge={R:1}" appendQueryString="false" />
        </rule>
        <rule name="Habbo Imaging Avatarimage 1">
          <match url="^habbo-imaging/avatar/([^/]+)" ignoreCase="false" />
          <action type="Rewrite" url="habbo-imaging/avatarimage.php?figure={R:1}" appendQueryString="false" />
        </rule>
        <rule name="Habbo Imaging Avatar Image 2">
          <match url="^habbo-imaging/avatarimage/([^/]+)" ignoreCase="false" />
          <action type="Rewrite" url="habbo-imaging/avatarimage.php?username={R:1}" appendQueryString="false" />
        </rule>
        <rule name="Habbo Imaging Avatar Head">
          <match url="^habbo-imaging/head/([^/]+)" ignoreCase="false" />
          <action type="Rewrite" url="habbo-imaging/head.php?figure={R:1}" appendQueryString="false" />
        </rule>
        <rule name="Forum Threads">
                <match url="^thread/([0-9]+)" />
                <action type="Rewrite" url="index.php?url=thread&amp;threadid={R:1}" />
                </rule>
                <rule name="Forum Posts">
                <match url="^post/([0-9]+)" />
                <action type="Rewrite" url="index.php?url=post&amp;postid={R:1}" />
                </rule>
              
                <rule name="Forum New Thread">
                <match url="^create/([0-9]+)" />
                <action type="Rewrite" url="index.php?url=newthread&amp;thread={R:1}" />
                </rule>


            </rules>
            
            
        </rewrite>
    </system.webServer>
</configuration>
 

Higoka

Active Member
Dec 16, 2018
174
74
what a mess. you have sometimes the same rules multiple times and some nonsense rules but to avoid collision remove all home rules and use this.
Code:
<rule name="home rule">
 <match url="^home/(.*)$" ignoreCase="false" />
 <action type="Rewrite" url="index.php?url=home&amp;user={R:1}" appendQueryString="true" />
</rule>
now yourhotel.com/home/username will result in yourhotel.com/index.php?url=home&user=username
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
I apologize I misread your thread the first time while on my phone. I now see you did want URL rewriting and not switching from GET to POST, I'm sorry about that.
 

RizyGFX

Graphics Designer
Feb 26, 2018
132
106
I apologize I misread your thread the first time while on my phone. I now see you did want URL rewriting and not switching from GET to POST, I'm sorry about that.

are you too busy to try to fix it right now ill msg u dets im not understanding how to do it right. i did what he said^ but it aint work
 

Users who are viewing this thread

Top