943,948 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 11996
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Feb 25th, 2009
0

How to hide query string in url with .htaccess

Expand Post »
Hello...
Good Morning All...

How to hide all query strings in my url and here i can't use hidden variables for these all because in all times i couldn't send them with form submission..And my page is having four query strings to be sent...

If any body have any clues or information about this...
Please i request you to place here...

Thanks in Advance...
Shanti.
Last edited by Shanti C; Feb 25th, 2009 at 12:43 am.
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Feb 25th, 2009
1

Re: How to hide query string in url with .htaccess

Do you meen something like sessions. Sessions will allow you to pass variables between pages and are very simple to use. Simple place at the very top of your pages that use sessions the following code:
php Syntax (Toggle Plain Text)
  1. <?
  2. session_start();
Then below is an example of how to use the session array:
php Syntax (Toggle Plain Text)
  1. <?
  2. session_start();
  3.  
  4. $_SESSION['variable_name']='apple';
  5. $_SESSION['testing']='orange'.
  6. ?>
  7. <a href='page2.php'>Page 2</a>
Then page2.php
php Syntax (Toggle Plain Text)
  1. <?
  2. session_start();
  3.  
  4. echo $_SESSION['variable_name'];
  5. echo " is different to a ";
  6. echo $_SESSION['testing'];
  7. ?>
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Feb 26th, 2009
0

Re: How to hide query string in url with .htaccess

No...
thanks for your quick reply...

Is it possible with rewriting concept...

And one more thing..
should i use only one .htaccess file to access all of my folders in mysite.. And how to use rewrite conditions..

Thanks in advance...
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Feb 26th, 2009
0

Re: How to hide query string in url with .htaccess

You could just use form method POST
Sponsor
Reputation Points: 520
Solved Threads: 268
Code Monkey
ShawnCplus is offline Offline
1,564 posts
since Apr 2005
Feb 26th, 2009
0

Re: How to hide query string in url with .htaccess

checkout the apache.org mod_rewrite tutorials
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Feb 26th, 2009
0

Re: How to hide query string in url with .htaccess

thanks for all inputs..
Any more clear information about this????

I am struggling about this....
Last edited by Shanti C; Feb 26th, 2009 at 5:56 am.
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Feb 26th, 2009
0

Re: How to hide query string in url with .htaccess

Well I just don't see how it is possible to use a htaccess file to hide the url info unless you have a dedicated virtual file for each possible input variable.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Feb 26th, 2009
0

Re: How to hide query string in url with .htaccess

unless you have a dedicated virtual file for each possible input variable. Means???
Last edited by Shanti C; Feb 26th, 2009 at 8:05 am.
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Feb 26th, 2009
0

Re: How to hide query string in url with .htaccess

means for each possible hidden value, there would need to be a different file path.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Feb 26th, 2009
1

Re: How to hide query string in url with .htaccess

Rewrite rules don't actually hide the query string. Rewrite rules pretty much convert seo friendly urls into the actual query string.
Example .htaccess:
PHP Syntax (Toggle Plain Text)
  1. RewriteEngine on
  2. RewriteRule ([^/\.]+)/?.html$ viewPage.php?ID=$1 [L]
The above rewrite rule will allow you to do something like this:
url reads: yoursite.com/DaniWeb.html
apache interprets as: yoursite.com/viewPage.php?ID=DaniWeb
Therefore
php Syntax (Toggle Plain Text)
  1. <?php
  2. $id=$_GET['ID'];
  3. echo $id;
  4. ?>
will output DaniWeb.
Reputation Points: 232
Solved Threads: 137
Practically a Master Poster
buddylee17 is offline Offline
665 posts
since Nov 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: File Encription
Next Thread in PHP Forum Timeline: Payment gateways?( urgent)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC