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.

Recommended Answers

All 18 Replies

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:

<?
session_start();

Then below is an example of how to use the session array:

<?
session_start();

$_SESSION['variable_name']='apple';
$_SESSION['testing']='orange'.
?>
<a href='page2.php'>Page 2</a>

Then page2.php

<?
session_start();

echo $_SESSION['variable_name'];
echo " is different to a ";
echo $_SESSION['testing'];
?>
commented: Good Information...Thanks... +3

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...

You could just use form method POST

checkout the apache.org mod_rewrite tutorials

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

I am struggling about this....

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.

unless you have a dedicated virtual file for each possible input variable. Means???

means for each possible hidden value, there would need to be a different file path.

Rewrite rules don't actually hide the query string. Rewrite rules pretty much convert seo friendly urls into the actual query string.
Example .htaccess:

RewriteEngine on 
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
$id=$_GET['ID'];
echo $id;
?>

will output DaniWeb.

commented: Thanks Man... +3

Honestly, you have been given the proper solutions. Sending (and therefore, reading) your forms with the POST method sends variables through the headers sent. For this purpose, however, I would recommend SESSIONs as people could potentially look at the header information. SESSION variables are contained solely on the server (aside from the associated client COOKIE which only contains the SESSION ID).

Honestly, you have been given the proper solutions. Sending (and therefore, reading) your forms with the POST method sends variables through the headers sent. For this purpose, however, I would recommend SESSIONs as people could potentially look at the header information. SESSION variables are contained solely on the server (aside from the associated client COOKIE which only contains the SESSION ID).

Well that's a good approach except for the fact that you somehow have to get the data to the PHP script first so the data can be placed in the session :)

Oh wow, how did I miss that part? Sorry 'bout that one.

Theres not a secure way to transfer data through a URL even if you cover it with .htaccess because its still accessible.

thank you for all especially death_oclock, ShawnCplus, !Unreal and budleee.....

One more thing..
How to write rewrite conditions on .htaccess file...please give me some explanation rather than tutorials...
And in my site, i had written .htaccess file for every folder individually. Is it correct or not??
Tel some tips on this concept..
And quote me with 404 error solution with URL ReWriting..

Thank you so much for all.....
Shanti
INDIA.

And in my site, i had written .htaccess file for every folder individually. Is it correct or not??

That is sort of correct but you can also make virtual folders with .htaccess. An example is the following:

RewriteEngine on 
RewriteRule *\/([^/\.]+)/?.html$ viewPage.php?ID=$1 [L]

Note that RewriteEngone on generally goes at the top of the .htaccess file and only appears once (generally). And the above example will rewrite all html files inside all subdirectories of the htaccess file to the php file.

And quote me with 404 error solution with URL ReWriting..

The following code will do the trick:

ErrorDocument 404 /path/to/file.html

Don't forget the first forward slash in the above code path.
Enjoy

thank u cwarn23 ....
what does the line ErrorDocument 404 /path/to/file.html will do?????

what does the line ErrorDocument 404 /path/to/file.html will do?????

It sets the error 404 (file not found) page to your custom page.

thank you very much cwarn23 for your continues replies...
thanks all....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.